From: Kbwms AT aol DOT com Message-ID: Date: Mon, 16 Nov 1998 13:52:11 EST To: Eli Zaretskii Cc: djgpp-workers AT delorie DOT com Mime-Version: 1.0 Subject: Re: src/libc/ansi/stdlib/rand.c Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Mailer: AOL 3.0 16-bit for Windows sub 38 Reply-To: djgpp-workers AT delorie DOT com Dear Eli Zaretskii, On 11-16-98 at 04:25:17 EST you wrote: > > Doesn't this violate the ANSI Standard? My references indicate that > it requires the implementation to ``behave as if the target > environment calls "srand(1)" at program startup.'' (Which also means > that `next' should start with 1, not 0.) > Please cite the references. As nearly as I can determine, and as stated in "The Standard C library," (page 350) 'The behavior of *rand* can vary among implementations.' > I think most people would expect `rand' to produce the same sequence > unless they called `srand', even if ANSI doesn't mandate it. > You have a point. But learned usage should prompt a user to call *srand* with the same parameter to get a deterministic result. > > I think ANSI specifies that ``implementation shall behave as if no > library function calls the `rand' function.'' If I'm right, this > violates that requirement. (Why are the calls to `rand' a good idea, > anyway?) The extra calls cleanse the generator. I'd like to see about 50 calls but three might be enough. K.B. Williams