mardi 1 septembre 2015

PHP rand function generates wrong values

I've got a little issue with the php function rand. Array is an array with numbers between 0.1 and 1.

 $min = $this->array[0]*10;
 $max = $this->array[1]*10;
 array_push($this->motor, rand($min, $max), rand($min,$max));

Once in a while rand generates 0 the rest of the time the rand function works fine. Does somebody knows what I'm doing wrong?




Aucun commentaire:

Enregistrer un commentaire