From:             anakin at php dot pl
Operating system: Windows XP
PHP version:      4.3.4
PHP Bug Type:     Math related
Bug description:  range problem

Description:
------------
Using array_rand wirh range function produces incorrect results.

Reproduce code:
---------------
<?php
 srand();
 print_r(array_rand(range(1, 6), 6));
?>

Expected result:
----------------
An array with numbers from 1 to 6 shuffled.

Actual result:
--------------
For example:
Array ( [0] => 4 [1] => 2 [2] => 3 [3] => 1 [4] => 0 [5] => 5 ) 
See key '4'. 0 (zero) does not match range(1, 6).

-- 
Edit bug report at http://bugs.php.net/?id=28305&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28305&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28305&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28305&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28305&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28305&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28305&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28305&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28305&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28305&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28305&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28305&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28305&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28305&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28305&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28305&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28305&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28305&r=float

Reply via email to