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

Markers not showing up after opening a saved project. Where did they go!?

Object Fitting Keyboard Shortcuts Disfuntional

how to devide a circle into equal parts