note 28724 deleted from function.rand by aidan
| From: | aidan@php.net | Date: | Sat, 11 Sep 2004 07:43:48 +0000 |
| Subject: | note 28724 deleted from function.rand by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76456@lists.php.net to get a copy of this message | ||
Note Submitter: Antonio Marra - UniLE
----
This function has partially (and undocumentally) changed its behaviour.
On PHP 4.0.6 (i586 Linux), the call
rand(1,4294967295)
(that's 2^32-1) gives random values in the specified range, while on PHP 4.2.3 (i586 Linux) the
same call always returns a 1 (one) value. In this case the maximum value that can be used with a
readable behaviour is
rand(1,2147483647)
(that's 2^31-1).
It seems that the last argument is now interpreted as a signed int, while it was not before. In
fact, other values into the 2147483647-4294967295 range seems to be "wrapped" into
negative integers.