Bug #17138 Updated: array_rand() is not random

From: Date: Mon, 03 Jun 2002 18:00:07 +0000
Subject: Bug #17138 Updated: array_rand() is not random
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-9366@lists.php.net to get a copy of this message
ID: 17138 Updated by: edink@php.net Reported By: d.crawford@blueyonder.co.uk -Status: Open +Status: Closed Bug Type: Arrays related Operating System: Windows 98 PHP Version: 4.2.0 New Comment: This bug has been fixed in CVS. You can grab a snapshot of the CVS version at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites. Thank you for the report, and for helping us make PHP better. The fix will be included in the next release of PHP. Previous Comments: ------------------------------------------------------------------------ [2002-05-21 17:56:55] matthias.thalmann@sciontec.com 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#9366) next »