#22988 [Asn->Csd]: I'm feeling lucky - rand() bug
| From: | pollita@php.net | Date: | Wed, 13 Aug 2003 00:58:24 +0000 |
| Subject: | #22988 [Asn->Csd]: I'm feeling lucky - rand() bug | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969355740@lists.php.net to get a copy of this message | ||
ID: 22988
Updated by: pollita@php.net
Reported By: vakmajom at freemail dot hu
-Status: Assigned
+Status: Closed
Bug Type: Documentation problem
Operating System: Windows 2000
PHP Version: 4.3.2RC1
Assigned To: pollita
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-05-11 08:36:09] moriyoshi@php.net
changing to the correct status
------------------------------------------------------------------------
[2003-05-06 14:29:26] vakmajom at freemail dot hu
Why it is a Windows bug? Because RAND_MAX is not 2147483647?
Alrigth then.
But the documentation should also mention that you must not call
rand(min, max) or mt_rand(min, max)
if (max-min > 2147483647) (on unix systems you get a Warning message
(tested with PHP 4.1.0), but on Windows systems mt_rand(-2147483648,
2147483647) simply returns
-2147483648, without any warning message - as I explained.
------------------------------------------------------------------------
[2003-04-26 16:56:07] pollita@php.net
Actually the docs should mention this. Reclassifying and opening back
up.
------------------------------------------------------------------------
[2003-04-26 16:55:38] pollita@php.net
After discussion it looks like PHP won't be getting into the business
of fixing windows bugs :)
As you suggested the best bet is to stick with mt_rand() to get the
resulution you're looking for.
------------------------------------------------------------------------
[2003-04-18 00:03:55] pollita@php.net
I can see where you were going with that, unfortunately it has the
unexpected result of simply chaning the bug so that only *odd* numbers
get returned....
I'm still thinking over this one and hope you give it some more thought
too.... :)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/22988
--
Edit this bug report at http://bugs.php.net/?id=22988&edit=1