I want to generate a random 4 digit pin without repeat and sequence numbers. I have tried the below code but it only preventing repeat numbers, it is still returning sequence numbers.
function randomGen($min, $max, $quantity) {
$numbers = range($min, $max);
shuffle($numbers);
return array_slice($numbers, 0, $quantity);
}
$random = randomGen(1,9,4);
$random_no = "";
foreach($random as $int){
$random_no.=$int;
}
$random_no = intval($random_no);
expected output : 4759
Should not be like this 5537 and 7312