Bug #17138 Updated: array_rand() is not random
| From: | matthias dot thalmann at sciontec dot com | Date: | Tue, 21 May 2002 21:56:56 +0000 |
| Subject: | Bug #17138 Updated: array_rand() is not random | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-8129@lists.php.net to get a copy of this message | ||
ID: 17138
Updated by: matthias.thalmann@sciontec.com
Reported By: d.crawford@blueyonder.co.uk
Status: Open
Bug Type: Arrays related
Operating System: Windows 98
PHP Version: 4.2.0
New Comment:
I've experienced the same problem on Win2K and WinNT4, regardless what
your seed for srand() is. In PHP 4.1.2 everything's fine.
Previous Comments:
------------------------------------------------------------------------
[2002-05-10 07:29:09] d.crawford@blueyonder.co.uk
The code from the manual:
srand ((float) microtime() * 10000000);
$input = array ("Neo", "Morpheus", "Trinity", "Cypher",
"Tank");
$rand_keys = array_rand ($input, 2);
print $input[$rand_keys[0]]."\n";
print $input[$rand_keys[1]]."\n";
always returns the same array elements.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17138&edit=1