<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Challenge everything! &#187; Programming</title>
	<atom:link href="http://blogs.gnome.org/raywang/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.gnome.org/raywang</link>
	<description>Ray Wang&#039;s notes</description>
	<lastBuildDate>Mon, 30 May 2011 03:11:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>		<item>
		<title>srandom 与 random</title>
		<link>http://blogs.gnome.org/raywang/2009/02/19/srandom-%e4%b8%8e-random/</link>
		<comments>http://blogs.gnome.org/raywang/2009/02/19/srandom-%e4%b8%8e-random/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 03:38:19 +0000</pubDate>
		<dc:creator>raywang</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[c]]></category>

		<guid isPermaLink="false">http://raywang.yo2.cn/articles/srandom-%e4%b8%8e-random.html</guid>
		<description><![CDATA[今天看了看这两个函数的manpage，srandom 的作用是为random 做个种子，默认random生成的数是以srandom(1)为种子的。所以，虽然random 生成的数好像没什么规律，但每次生成的数都是一样的。如果想要改变这个所谓的“随机数”，就要再说srandom生成一个新的种子，比如srandom(2)，不过这样做太麻烦了，先拿srandom(time(0))充个数吧。 #include &#60;stdlib.h&#62; #include &#60;stdio.h&#62; int main() { srandom(time(NULL)); printf(&#8220;the number is %ld\n&#8221;, random()); }]]></description>
			<content:encoded><![CDATA[<p>今天看了看这两个函数的manpage，srandom 的作用是为random 做个种子，默认random生成的数是以srandom(1)为种子的。所以，虽然random 生成的数好像没什么规律，但每次生成的数都是一样的。如果想要改变这个所谓的“随机数”，就要再说srandom生成一个新的种子，比如srandom(2)，不过这样做太麻烦了，先拿srandom(time(0))充个数吧。</p>
<p>#include &lt;stdlib.h&gt;<br />
#include &lt;stdio.h&gt;</p>
<p>int main()<br />
{<br />
srandom(time(NULL));<br />
printf(&#8220;the number is %ld\n&#8221;, random());<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/raywang/2009/02/19/srandom-%e4%b8%8e-random/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blogs.gnome.org/raywang/category/programming/feed/ ) in 1.38638 seconds, on Feb 10th, 2012 at 8:31 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 10th, 2012 at 9:31 pm UTC -->
