note 16513 added to function.srand
| From: | mlwmohawk at mohawksoft dot com | Date: | Fri, 02 Nov 2001 12:51:56 +0000 |
| Subject: | note 16513 added to function.srand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-20301@lists.php.net to get a copy of this message | ||
srand() is pretty tricky to get right. You should never seed a random number generator more than
once per php process, if you do, your randomness is limited to the source of your seed.
The microtime function's micro-seconds portion has a very finite resolution, that is why the
make_seed function was added to the document. You should never get the same seed twice.
In the later CVS versions, PHP will seed the random generator prior to performing a rand() if
srand() was not previously called.
--
http://www.php.net/manual/en/function.srand.php
http://master.php.net/manage/user-notes.php?action=edit+16513
http://master.php.net/manage/user-notes.php?action=delete+16513
http://master.php.net/manage/user-notes.php?action=reject+16513