#26381 [NEW]: rand() without srand() doesn't work
| From: | spam at vrana dot cz | Date: | Mon, 24 Nov 2003 13:21:33 +0000 |
| Subject: | #26381 [NEW]: rand() without srand() doesn't work | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-50917@lists.php.net to get a copy of this message | ||
From: spam at vrana dot cz
Operating system: Windows XP
PHP version: 4.3.3
PHP Bug Type: Math related
Bug description: rand() without srand() doesn't work
Description:
------------
Function rand() without setting random seed by srand() returns always the
same value. It doesn't work only on Windows PHP-CLI. As Windows Apache
module and also on Linux PHP-CLI it works as it should.
Reproduce code:
---------------
echo rand();
Expected result:
----------------
(random value)
Actual result:
--------------
24849
--
Edit bug report at http://bugs.php.net/?id=26381&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26381&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26381&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26381&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26381&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26381&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=26381&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26381&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26381&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26381&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26381&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26381&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26381&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26381&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26381&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26381&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26381&r=float