#22988 [NEW]: I'm feeling lucky - rand() bug
| From: | vakmajom at freemail dot hu | Date: | Mon, 31 Mar 2003 18:36:52 +0000 |
| Subject: | #22988 [NEW]: I'm feeling lucky - rand() bug | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-36839@lists.php.net to get a copy of this message | ||
From: vakmajom at freemail dot hu
Operating system: Windows 2000
PHP version: 4.3.2RC1
PHP Bug Type: Math related
Bug description: I'm feeling lucky - rand() bug
The function rand() always returns an even number!
This bug appears when the parameters of rand() are near to the limits of
int (i.e. 2147483647)
Example:
<?php
echo(rand(1, 2147483647));
?>
Result: always an even number.
I'm using Apache 2.0.44 with PHP4.3.2RC1 (original Win32 binary) as an
apache module.
Tests with different systems:
Maybe this is a Windows bug, it still exists in Windows .Net server build
3718 with PHP 4.3.0 RC3
But everything is fine on a unix system with PHP 4.1.0
Strange... :))
--
Edit bug report at http://bugs.php.net/?id=22988&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22988&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=22988&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=22988&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22988&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=22988&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=22988&r=support
Expected behavior: http://bugs.php.net/fix.php?id=22988&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=22988&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=22988&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=22988&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22988&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=22988&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=22988&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=22988&r=gnused