note 53577 added to function.srand
| From: | bootc at bootc dot net | Date: | Mon, 06 Jun 2005 15:03:11 +0000 |
| Subject: | note 53577 added to function.srand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90010@lists.php.net to get a copy of this message | ||
OK, to summarize what people have been saying so far:
1. DO NOT seed the RNG more than once if you can help it!
2. You HAVE TO seed the RNG yourself if you are using PHP < 4.2.0.
3. Using a prime multiplier to microtime() probably does very little. Use the Mersenne Twister
instead.
4. You can use the Mersenne Twister PRNG with the mt_rand and mt_srand functions. This is faster and
is more random.
----
Manual Page -- http://www.php.net/manual/en/function.srand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53577
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53577&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53577&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53577&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53577&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53577&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53577&report=yes
Search -- http://master.php.net/manage/user-notes.php