Tags
Asked 3 years ago
14 Jul 2021
Views 340
Mauricio

Mauricio posted

Generate array of random unique numbers in PHP

Generate array of random unique numbers in PHP
i need to generate array of fixed number of random unique numbers
QuickIos

QuickIos
answered Jul 17 '21 00:00

in php rand() function will give you random number in the given range


function GenerateArrayOfUniqueNumber($i){
$array='';
for($j=0;$i<=$i;$i++){
$array[]=rand(rand(12,1000000)*$i,rand(12,1200000)*$i);
}
return $array;
}
Post Answer