Bug #16926: Shuffle doesn't work
| From: | joseppo at hotmail dot com | Date: | Tue, 30 Apr 2002 12:14:09 +0000 |
| Subject: | Bug #16926: Shuffle doesn't work | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-6563@lists.php.net to get a copy of this message | ||
From: joseppo@hotmail.com
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 * 100000);
}
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=16926&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16926&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16926&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16926&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16926&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16926&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16926&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16926&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16926&r=submittedtwice