From: Myknees AT aol DOT com Message-ID: <49429c31.34d7b4bf@aol.com> Date: Tue, 3 Feb 1998 19:22:21 EST To: eliz AT is DOT elta DOT co DOT il Cc: dj AT delorie DOT com, djgpp AT delorie DOT com Mime-Version: 1.0 Subject: Re: Documentation [was Re: Random implementation] Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit Precedence: bulk In article , Eli Zaretskii writes: >The Evil Empire of Creeping Typos strikes back? ;-) If I was Charlie Brown I would say, "AAAAAAAAAAAARRRRRRRRRRRRGH!!!" *** src/libc/ansi/stdlib/rand.old Mon Jul 10 01:39:56 1995 --- src/libc/ansi/stdlib/rand.txh Tue Feb 3 18:50:08 1998 *************** *** 5,24 **** #include int rand(void); @end example @subheading Description Returns a pseudo-random number from zero to @code{RAND_MAX}. @subheading Return Value ! The number. @subheading Example @example /* random pause */ for (i=rand(); i; i--); @end example --- 5,48 ---- #include int rand(void); + void srand(unsigned _seed); @end example @subheading Description Returns a pseudo-random number from zero to @code{RAND_MAX}. + This function has its own default seed but may also be seeded with the + function @code{srand}. It is + only necessary to use @code{srand} in the following cases: + + @itemize @bullet + + @item + + If the pseudo-random sequence must be different each time you run the + program + + @item + + If the sequence must continue from the same place it ended on some + previous run + + @end itemize + @subheading Return Value ! The pseudo-random number. @subheading Example @example /* random pause */ for (i=rand(); i; i--); + @end example + + @example + /* seed rand with current time */ + srand(time(0)); @end example