On 02/18/2016 04:45 PM, Zeev Suraski wrote:
With rand functions, I don't think we need to touch them. For some
applications, low-key randomness is just fine - if you need to shuffle
array of 20 elements or randomize unit test to ensure you're not testing
same value all the time, low-quality randomness is completely fine. For
other applications, there are superior solutions and everybody who needs
them already uses them, but again I see no value in removing those
functions. It would only cause more breakage and make adoption of new
versions (already horrible) even slower.
I think the obvious option here is to make rand() and srand() aliases to
rand_mt() and srand_mt(), unless I'm missing something very basic, unless I'm
missing something very basic here..? I see zero reason to deprecate them and
break so much code when we can simply 'upgrade' them at zero cost to both us
and users.
Aliasing to mt_rand() definitely makes sense. With a name like `rand()`,
everyone will use it just because it is an obvious and common name for
the normal way to generate random numbers. Aliasing essentially will
make `rand()` as everyone uses it, better.
--
Stephen
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php