ID: 43108 Comment by: crescentfreshpot at yahoo dot com Reported By: cetra3 at hotmaill dot com Status: Open Bug Type: Math related Operating System: Windows XP PHP Version: 5.2.4 New Comment:
> with numbers 5 and 10 producing lower counts Oh I see now. Previous Comments: ------------------------------------------------------------------------ [2007-10-31 17:01:29] crescentfreshpot at yahoo dot com http://en.wikipedia.org/wiki/Principle_of_indifference A hundred million times is a shitload dude. ------------------------------------------------------------------------ [2007-10-26 09:44:47] cetra3 at hotmaill dot com Description: ------------ The function Rand will produce predictable results. Reproduce code: --------------- <?php $array_random = array_fill(1,10,1); for($i=0;$i<100000000;$i++) { $array_random[rand(1,10)]++; } print_r($array_random); ?> Expected result: ---------------- This should produce an array which counts how many times each number is picked at random. It should return a different result each time. Actual result: -------------- Instead of getting purely random responses, we get predictable ones, in this example there will be tainted results, with numbers 5 and 10 producing lower counts: Array ( [1] => 10000594 [2] => 10000610 [3] => 10000633 [4] => 10000589 [5] => 9997562 [6] => 10000606 [7] => 10000568 [8] => 10000620 [9] => 10000645 [10] => 9997583 ) You will always see these types of return values. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43108&edit=1
