php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19869 bug in array_rand
Submitted: 2002-10-11 13:12 UTC Modified: 2002-10-11 19:24 UTC
From: klashley at rtsg dot uwi dot tt Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.2.2 OS: windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: klashley at rtsg dot uwi dot tt
New email:
PHP Version: OS:

 

 [2002-10-11 13:12 UTC] klashley at rtsg dot uwi dot 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-11 15:04 UTC] sander@php.net
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
 [2002-10-11 19:24 UTC] edink@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 11 02:01:30 2024 UTC