#19869 [Opn->Fbk]: bug in array_rand
| From: | sander@php.net | Date: | Fri, 11 Oct 2002 20:04:38 +0000 |
| Subject: | #19869 [Opn->Fbk]: bug in array_rand | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-22176@lists.php.net to get a copy of this message | ||
ID: 19869
Updated by: sander@php.net
Reported By: klashley@rtsg.uwi.tt
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: windows
PHP Version: 4.2.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2002-10-11 13:12:25] klashley@rtsg.uwi.tt
I've found a bug with array_rand in PHP 4.2.2; it works in earlier
versions, however when tested in newer PHP versions the output never
changes.
eg.
srand ((double)microtime()*1000000);
$backgrounds = range (1,28);
$rand_keys = array_rand ($backgrounds, 3);
print
$backgrounds[$rand_keys[0]]."~".$backgrounds[$rand_keys[1]]."~".$backgrounds[$rand_keys[2]];
This would always for me produce the same results for me whatever I
try.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19869&edit=1