70 lines
1015 B
HTML
70 lines
1015 B
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>rand(3)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>rand(3)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
rand, srand - random number generator
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>#include</STRONG> <STRONG><stdlib.h></STRONG>
|
|
|
|
<STRONG>void</STRONG> <STRONG>srand(unsigned</STRONG> <EM>seed</EM><STRONG>)</STRONG>
|
|
<STRONG>unsigned</STRONG> <STRONG>rand(void)</STRONG>
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
<STRONG>Rand</STRONG> uses a multiplicative congruential random number generator with
|
|
period 2**32 to return successive pseudo-random numbers in the range from
|
|
0 to <STRONG>RAND_MAX</STRONG>.
|
|
|
|
The generator is reinitialized by calling <STRONG>srand</STRONG> with 1 as argument. It
|
|
can be set to a random starting point by calling <STRONG>srand</STRONG> with whatever you
|
|
like as argument.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man3/random.3.html">random(3)</A></STRONG>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|