Re: Seeding rand() at process start?

From: Date: Fri, 21 Sep 2001 15:25:17 +0000
Subject: Re: Seeding rand() at process start?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-66290@lists.php.net to get a copy of this message
On Fri, 21 Sep 2001 09:09:07 -0400 (EDT) mlwmohawk@mohawksoft.com wrote: :Does it make sense for PHP to seed rand() with srand() when it starts up, :during MINIT in basic_functions.c? : :It just seems that there is no good way to ensure you have a good seed for :random, and if rand() were "ready to use, out of the box" a lot of people :would not be pulling their hair out trying to fabricate a clean seed. :Besides one should seed only once, more often than that circumvents the :"randomness" of a random number generator. : :On UNIX we could seed rand() with /dev/urandom, else we could use time of :day. (Any other suggestions would be welcome.) <http://www.fourmilab.ch/hotbits/> You can pick up as many random bytes as you want; usually use a 16-bit INT as a seed. -- Tony Reed <trljc@altern.org> "The President was assassinated by a precision guerrilla team of at least seven men ..." -- Jim Garrison

« previous php.dev (#66290) next »