note 59266 added to function.mt-srand
| From: | vbassassin at coderheaven dot com | Date: | Thu, 01 Dec 2005 04:57:04 +0000 |
| Subject: | note 59266 added to function.mt-srand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99396@lists.php.net to get a copy of this message | ||
"Better still: Use a 31-bit hash of microtime() as the seed. "
Correct me if i am wrong, but woudlnt using microtime() still limit the total seeds to 1,000,000
again? Since the 31-bit hash will always give the same hash for the same number, and in the
microtime() function you could have 1,000,000 or less numbers. So in effect your still no better off
at all :-p
Best regards,
scott
PS: I actually agree that PHP has pretty much resolved the issue and got as close as anyones going
to get to solving the seeding issue by introducing the "Mersenne Twister" algorithm which
creates a much larger pool than 1,000,000 numbers. Just because the mt_srand() function exists
doesnt mean you HAVE to use it ;-) use it if you NEED a specific list of the same numbers (comes in
handy for encryptions with passwords ;-)
----
Manual Page -- http://www.php.net/manual/en/function.mt-srand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59266
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59266&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59266&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59266&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59266&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59266&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59266&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59266&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59266&report=yes
Search -- http://master.php.net/manage/user-notes.php