Sender: nate AT cartsys DOT com Message-ID: <37433F88.F64C6227@cartsys.com> Date: Wed, 19 May 1999 15:47:36 -0700 From: Nate Eldredge X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.5 i586) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: ** Random error ** References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Dlanor Blytkerchan wrote: > > >On Tue, 18 May 1999, Ronald Landheer wrote: > >> In libc, there is some reference to random() not being all that random. > >No, it's random even more than rand(). > Then it was the other way around ;-) > What I don't understand is why it would be diffirent at all, if both use > the RNG (random number generator), or does one use the RNG and the other an > array of randomly picked integers? I've seen some programs that implement > their own RNG code to make sure random numbers are the same on every > computer (in VGA Planets, this is important for battle outcome to be the > same on the host- and player-side computer, so the player can watch the > battle). Does either rand() or random() do something similar (that you know > of - don't download and check the source on my account ;-> ) There is no such thing as "the" random number generator. RNG just refers to an algorithm; those used by `rand' and `random' are different. `rand' uses a simple linear congruential random number generator. `random', however, can use a similar algorithm or any of several more complex ones (see `initstate' to try them). Even a glance at the source will show it: rand.c is 23 lines, random.c is 365. `random' is apparently more random, but due to a variety of confusing legal issues, nobody is quite sure if we can use its code for `rand', and so to be safe the two different RNG's remain. -- Nate Eldredge nate AT cartsys DOT com