Re:A call to PHP's mt_rand generates only odd numbers
by TazeTSchnitzel on Friday July 24, 2015 @01:42PM
(#9943770)
> Why even accept ranges that span more than 2^32? That seems like an easy solution to a broken function.
It may never have been designed to. If it was written before 64-bit machines were commonplace, mt_getrandmax() would always be the same as PHP_INT_MAX.
Re:A call to PHP's mt_rand generates only odd numbers
by poizan42 on Friday July 24, 2015 @10:38AM
(#9942270)
Why not generate two values from the underlying function and shift them into place if the range is larger than 2^32 -1?
Oh well, ofc. because this is PHP which goes by the principle of most surprise.
Also fun:
is always even on my PHP 5.5.20.