Doc #55446 [NEW]: getrandmax() incorrectly defined on rand() page
| From: | danielklein at airpost dot net | Date: | Thu, 18 Aug 2011 04:44:58 +0000 |
| Subject: | Doc #55446 [NEW]: getrandmax() incorrectly defined on rand() page | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-7030@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: Irrelevant
Package: Website problem
Bug Type: Documentation Problem
Bug description:getrandmax() incorrectly defined on rand() page
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 bug report at https://bugs.php.net/bug.php?id=55446&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55446&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55446&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55446&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55446&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55446&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55446&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55446&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55446&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55446&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55446&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55446&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55446&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55446&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55446&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55446&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55446&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55446&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55446&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55446&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55446&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55446&r=mysqlcfg