Seeding rand() at process start?
| From: | mlwmohawk at mohawksoft dot com | Date: | Fri, 21 Sep 2001 13:09:07 +0000 |
| Subject: | Seeding rand() at process start? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-66283@lists.php.net to get a copy of this message | ||
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.)