Is Rand not random at all?


i playing around tonight , came following:

 

<?php     $mynumber = 0;     $numberflip = 0;     while ($mynumber < 9) {         $roll = rand(0,2);         $numberflip ++;              if ($roll == 1) {                  $mynumber ++;             }             elseif ($roll == 0) {                 $mynumber = 0;             }             else {                 $mynumber = 0;             }                         }     echo "<p>it took {$numberflip} flips!</p>"     ?> 

 

the issue - each time refresh page -  gives possibility of couple answers , keeps cycling through answers repeatedly in order.  (4,008 flips, 8,922, 1,421, 452, 18,417)

 

why on earth that?   shouldn't more random that?



More discussions in Dreamweaver support forum


adobe

Comments

Popular posts from this blog

how to devide a circle into equal parts

"Could not fill because there are not enough opaque source pixels" - not solved by any other thread

Why can't I change the billing info for my account?