ID:               45302
 Updated by:       [EMAIL PROTECTED]
 Reported By:      sv4php at fmethod dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Math related
 Operating System: Windows XP
 PHP Version:      5.2.6
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #45301


Previous Comments:
------------------------------------------------------------------------

[2008-06-18 17:08:08] sv4php at fmethod dot com

Description:
------------
This was discovered by another guy who asked me to verify it on my
configuration (and I confirmed it). I'm not sure he reported it, so just
in case I do as well.

The example source code produced 989, 377, 989, 377 from rand() ad
infinitum under Windows XP, Apache 2.2, PHP 5.2.6.

Important:

- Linux apparently not affected.
- mt_rand() apparently not affected.

Reproduce code:
---------------
function RandomNumber() {
        $f1 = array();

        for ($i = 0; $i < 50000; $i++) {                
                $f1[] = true;
        }       
                        
        $k = array_rand($f1);
        
        $rnum = rand(1,999);    
        
        return $rnum;
}

for ($i = 0; $i < 20; $i++) {
        
        echo RandomNumber()."\n"; // produces a sequence of 377, 989, 377,
989, 377, 989, 377...  here
}

Expected result:
----------------
Random numbers.

Actual result:
--------------
Same number or narrow repeated sequence.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45302&edit=1

Reply via email to