mercredi 16 septembre 2015

Why mt_rand generating same number repeatedly?

I have a simple code: mt_rand(1,25);

it is generating the same number over and over. MANY times before it will finally generate a new number.

6 months ago, it worked beautifully.

    $X = mt_rand(1,25) ;
     $AR=array(14, 126, 28, .......);
     $F = $AR[$X];

Then the $F is used in a math calculation...

The $X value is the one remaining the same on every page refresh or revisit.

See in action @ http://ift.tt/1FNx2pI

Select "Numbers Plus 9" on second row of buttons. Input a name and then the code should be generating different flashcards each time.




Aucun commentaire:

Enregistrer un commentaire