I need to create unique random pins using numbers only. I need to produce between 10,000,000 and 99,999,999. I need to create 100,000 pins
Here's the code I am currently using:
function UniqueRandomNumbersWithinRange($min, $max, $quantity) {
$numbers = range($min, $max);
shuffle($numbers);
return array_slice($numbers, 0, $quantity);
}
print_r( UniqueRandomNumbersWithinRange(10000000,99999999,100000));
This code still runs okay with my server using 50000 but not with 100000 items. Can you help me, is there code that can produce this many unique numbers without using too much memory in the server?