dimanche 6 septembre 2015

PHP: rand() or array_rand trouble

Results in result2.txt repeats every ~100 string. Yes, same surnames and same rand(100000, 999999) results every ~100 program launching :(

NetBeans 8.0.2

//Get surname
$famtxt = file('surname.txt');
$surname = $famtxt[ array_rand($famtxt) ]; 
unset($famtxt); 

//Results
$result0=$surname.' '.rand(100000, 999999);                               
$resulttxt = fopen('result2.txt', 'a');
fwrite($resulttxt,$result0); 




Aucun commentaire:

Enregistrer un commentaire