Doc #55446 [Opn->Csd]: getrandmax() incorrectly defined on rand() page
| From: | rquadling@php.net | Date: | Thu, 18 Aug 2011 12:57:06 +0000 |
| Subject: | Doc #55446 [Opn->Csd]: getrandmax() incorrectly defined on rand() page | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-7032@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55446&edit=1
ID: 55446
Updated by: rquadling@php.net
Reported by: danielklein at airpost dot net
Summary: getrandmax() incorrectly defined on rand() page
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Website problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: rquadling
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
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/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-08-18 12:56:53] rquadling@php.net
Automatic comment from SVN on behalf of rquadling
Revision: http://svn.php.net/viewvc/?view=revision&revision=315138
Log: getrandmax returns 2^15 - 1, not 2 ^ 15 on Windows (and maybe others).
Fix bug #55446
------------------------------------------------------------------------
[2011-08-18 04:44:58] danielklein at airpost dot net
Description:
------------
getrandmax() returns 32767 on my Windows system, not 32768 as documented. This makes sense as 32767
is the highest unsigned 15 bit number. Also, setting min and max, while affecting the range, does
not affect the granularity. The result of rand(0, 0x7FFF00) will always be a multiple of 256
(0x100). This should be noted as I was trying to use rand() to produce more than 32767 unique
values. Please make a note in the rand() page that mt_rand() produces more unique values in this
case.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55446&edit=1