On Fri, Aug 19, 2016 at 8:20 PM, Lauri Kenttä <lauri.ken...@gmail.com> wrote:
> On 2016-08-15 18:53, Tom Worster wrote: > >> Hi Lauri, >> >> Do you have a PR against php-src on github? It's easier to read and >> comment. >> >> Tom >> > > > Here's a PR with a revised patch (also accepts other than pure integers): > > https://github.com/php/php-src/pull/2089 > > > And here's an alternative with no sanity checks at all, which makes the > patch even simpler (and more PHP-like, since 'foo' is silently converted to > zero; this truly the most marvelous feature of PHP). > > https://github.com/Metabolix/php-src/tree/mt_srand_array-v3 > Personally I'm not a fan of this. We should not perpetuate the use of mt_rand() as either a seedable random number generator or an implementation of a specific algorithm. We have broken the former in 7.1 (seed sequence change) and were close to breaking the latter (replacing mt19937 with xorshift128+). Instead, let's first introduce an object-based PRNG interface, which a) does not rely on volatile global state and b) is explicit about the choice of algorithm and seeding procedure. Thanks, Nikita