vendredi 30 octobre 2020

How to get 5 random number from 0 to 10 that all are different? php [duplicate]

suppose i have an array

$array = [2,55,66,446,98,353,5435,36,335,35,33,33,33,33,33,333,333];

I will need 5 random indexes

$random1 = rand(0, $array.length() -1);
$random2 = rand(0, $array.length() -1);

but some times they will give equal results. sorry for php and javascript mess up




Aucun commentaire:

Enregistrer un commentaire