note 16500 added to function.rand
| From: | trobinson-a-t-gksystems-d-o-t-com at php2 dot chek dot com | Date: | Fri, 02 Nov 2001 05:44:56 +0000 |
| Subject: | note 16500 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-20266@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
--
http://www.php.net/manual/en/function.rand.php
http://master.php.net/manage/user-notes.php?action=edit+16500
http://master.php.net/manage/user-notes.php?action=delete+16500
http://master.php.net/manage/user-notes.php?action=reject+16500