#40187 [NEW]: mt_rand(), rand()
| From: | callawey at gmail dot com | Date: | Sun, 21 Jan 2007 19:06:47 +0000 |
| Subject: | #40187 [NEW]: mt_rand(), rand() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-107840@lists.php.net to get a copy of this message | ||
From: callawey at gmail dot com
Operating system: windows xp
PHP version: 5.2.0
PHP Bug Type: Math related
Bug description: mt_rand(), rand()
Description:
------------
rand and mt_rand generates random lenght integer between -9999999999 and
+9999999999.
example mt_rand(100000000000, 999999999999);
outputs: -564, -688852, 5586666988, -68889558
Reproduce code:
---------------
$str = mt_rand(100000000000, 999999999999);
Expected result:
----------------
positive numbers between 100000000000 and 999999999999
Actual result:
--------------
-492911349,1162038978,-219333642
--
Edit bug report at http://bugs.php.net/?id=40187&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40187&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40187&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40187&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40187&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40187&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40187&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40187&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40187&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40187&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40187&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40187&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40187&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40187&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40187&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40187&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40187&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40187&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40187&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40187&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40187&r=mysqlcfg