#40724 [NEW]: srand returns different results in 5.2.1 than in previous versions

From: Date: Mon, 05 Mar 2007 07:52:38 +0000
Subject: #40724 [NEW]: srand returns different results in 5.2.1 than in previous versions
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-109890@lists.php.net to get a copy of this message
From: dave at dmorg dot org Operating system: linux, windows PHP version: 5.2.1 PHP Bug Type: Math related Bug description: srand returns different results in 5.2.1 than in previous versions Description: ------------ I use srand to seed random numbers with student id numbers so that whenever students relog in to an assignment, their questions have the same input values and they can continue where they left off. I am now getting different results than before. I'm not sure whether this is an unintended consequence of some apparently unrelated code change or whether it is intended. Reproduce code: --------------- <?php mt_srand(42); echo mt_rand(); ?> produces 1387371436 under 4.*, 5.1.1. 5.1.4 produces 1354439493 under 5.2.1 Expected result: ---------------- I would expect results from the random number generator to be consistent when seeded with the same number Actual result: -------------- produces 1387371436 under 4.*, 5.1.1. 5.1.4 produces 1354439493 under 5.2.1 -- Edit bug report at http://bugs.php.net/?id=40724&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40724&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40724&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40724&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40724&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40724&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40724&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40724&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40724&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40724&r=support Expected behavior: http://bugs.php.net/fix.php?id=40724&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40724&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40724&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40724&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40724&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40724&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40724&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40724&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40724&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40724&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40724&r=mysqlcfg

« previous php.bugs (#109890) next »