Bug #16926 Updated: Shuffle doesn't work
ID: 16926 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Feedback Bug Type: *Math Functions Operating System: WinXP PHP Version: 4.2.0 New Comment: Yes, I'm sure. I've tried running it from the command line with the same result. I've done a little more testing, and it seems that rand() seems to work just fine, so that should more or less exclude the possibility of a bug in srand(). I've also done a full reinstall (just to make sure) without any luck. Previous Comments: [2002-05-01 03:08:01] [EMAIL PROTECTED] I could not reproduce this, are you sure the browser is not caching your page? Derick [2002-04-30 08:14:09] [EMAIL PROTECTED] As of PHP 4.2.0, shuffle() doesn't seem to work for me. The following code always produce the same output: function make_seed() { // Taken directly from the manual list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 10); } srand(make_seed()); $arr = range(1, 10); shuffle($arr); print_r($arr); Further testing shows that I get the same output if I uncomment the srand(), if that's any help. -- Edit this bug report at http://bugs.php.net/?id=16926edit=1
Bug #16926: Shuffle doesn't work
From: [EMAIL PROTECTED] Operating system: WinXP PHP version: 4.2.0 PHP Bug Type: *Math Functions Bug description: Shuffle doesn't work As of PHP 4.2.0, shuffle() doesn't seem to work for me. The following code always produce the same output: function make_seed() { // Taken directly from the manual list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 10); } srand(make_seed()); $arr = range(1, 10); shuffle($arr); print_r($arr); Further testing shows that I get the same output if I uncomment the srand(), if that's any help. -- Edit bug report at http://bugs.php.net/?id=16926edit=1 -- Fixed in CVS:http://bugs.php.net/fix.php?id=16926r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=16926r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16926r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16926r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16926r=support Expected behavior: http://bugs.php.net/fix.php?id=16926r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16926r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16926r=submittedtwice