Re: Re: PRNG: Raise warning and/or provide better pseudo random generator?

From: Date: Wed, 24 Feb 2016 22:09:45 +0000
Subject: Re: Re: PRNG: Raise warning and/or provide better pseudo random generator?
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-91383@lists.php.net to get a copy of this message
Hi all, On Thu, Feb 25, 2016 at 6:31 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: >> I think it would be preferable to wait a bit -- there's clearly interest in >> replacing rand/mt_rand etc with a higher quality PRNG, so maybe lets give >> people time to create a proposal for that before we start throwing warnings. > > Reasonable suggestion! > Adding warnings is trivial. It could done before RC. > I'll wait until then. I updated the doc for the time being. http://svn.php.net/viewvc?view=revision&revision=338662 MT rand range is 2^32, but our mt_rand() implementation is 2^31. http://lxr.php.net/xref/PHP_5_6/ext/standard/rand.c#331 Because RAND_RANGE() macro simply does arithmetic on supplied parameters, out of range values result in biased numbers. Therefore, I replaced mt_rand() caution to my warning. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.internals (#91383) next »