Rowan Collins wrote:

> To be fair, that's not actually mutually exclusive with Leszek's
> suggestions - we still need to either document, or warn, that rand() has
> this limitation. The manual does actually mention using mt_rand(), but
> also suggests setting $max higher than getrandmax(), which is probably
> bad advice:
> 
>> If you require a range larger than 32767, specifying |min| and |max|
> will allow you to create a range larger than this, or consider using
> mt_rand() <http://php.net/manual/en/function.mt-rand.php> instead.

It seems to be noteworthy that the mt_rand man page contains a
respective warning[1], and the mt_getrandmax man page explains the issue
in the "Return Values" section[2].  I think it would be reasonable to
document rand/getrandmax alike in this regard.

[1]
<http://php.net/manual/en/function.mt-rand.php#refsect1-function.mt-rand-notes>
[2]
<http://php.net/manual/en/function.mt-getrandmax.php#refsect1-function.mt-getrandmax-returnvalues>

-- 
Christoph M. Becker


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

Reply via email to