note 16500 rejected from function.rand by zak
| From: | zak@php.net | Date: | Fri, 02 Nov 2001 07:06:41 +0000 |
| Subject: | note 16500 rejected from function.rand by zak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20283@lists.php.net to get a copy of this message | ||
Heads-up on Windows:
rand range is 32768 inclusive, otherwise a warning is generated (but it works anyway).
So @rand(0,99999999) works ok even though getrandmax() returns 32767.
mt_rand behaves the same on Windows/Linux, working happily to 2147483647, and even generates
identical results when unseeded, or seeded the same.
Lesson: use mt_rand.
Windows PHP version 4.0.6
Linux PHP version 4.0.4pl1