note 43277 added to function.srand
| From: | Codaholicsdotcom at rn2 dot php dot net | Date: | Wed, 16 Jun 2004 14:59:59 +0000 |
| Subject: | note 43277 added to function.srand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71148@lists.php.net to get a copy of this message | ||
office's comment about multiplying by 1234567 instead of 1000000 is slightly misguided for a
couple of reasons.
first, as the editor note would indicate, 1234567 is not a prime number.
second, the problem he is attempting to fix is that the random values are slowly converging. this,
however, is not a problem with the seeding of the random number generator, but a problem with the
RNG itself. most default RNGs that come with programming languages will converge because they were
written for efficiency and to function in everyday programs.
if you need a Pseudo Random Number Generator (PRNG) that is cryptographically secure and does not
converge after repeated use without seeding... you will unfortunately have to use a different
generator. There are several out there such as the MersenneTwister, Yarrow (by Bruce Schneierer of
Counterpane Security) and more being made every day. Due to the hassle of finding a reputable PRNG,
it is recommended that you only need to use those for issues that require strong security such as
gambling games and cryptography.
hope this cleared things up :)
----
Manual Page -- http://www.php.net/manual/en/function.srand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43277
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43277&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43277&report=yes
Search -- http://master.php.net/manage/user-notes.php