Hi,

> On 12 Jan 2015, at 01:20, Stanislav Malyshev <smalys...@gmail.com> wrote:
> 
>> The manual explicitly guarantees that code should not rely on the
>> random number generator being predictable.
> 
> Where exactly does it say that? The only note I've found is this:
> http://php.net/manual/en/function.mt-srand.php
> 
> 5.2.1 The Mersenne Twister implementation in PHP now uses a new seeding
> algorithm by Richard Wagner. Identical seeds no longer produce the same
> sequence of values they did in previous versions. This behavior is not
> expected to change again, but it is considered unsafe to rely upon it
> nonetheless.
> 
> Which just says we could change PRNG behavior between versions, and
> nothing about PRNG not being predictable.

It says it’s unsafe to rely upon the behaviour of seeding.

Also, FWIW, anyone who used the Suhosin patch couldn’t use srand() because it 
disabled it.

>> If people want their existing code to continue to work, we could of
>> course allow this new API to support the C stdlib rand() as an
>> algorithm for BC reasons. But such code was never supposed to work in
>> this first place.
> 
> If it works, breaking it should have a very good reason. I don't see any
> reason to break srand().

Because if we don’t break it, people will continue to rely on it, and this 
binds our hands for future versions. 

Also, those people will have their code break anyway if they upgrade their OS 
and it changes its random number generator.

Just because people do rely on it doesn’t mean they should or that we should 
continue to allow them to.

--
Andrea Faulds
http://ajf.me/





--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to