mardi 18 mai 2021

Generate 7 digit number similar to original number in PHP

I would like to generate 7 digit number that is very similar to the original randomized number in PHP.

The purpose is: the original randomized number simulates the telephone number that is used in a sound game where users identifies the correct number while listening to the audio.

Using loop

$original_randomized_number=rand(1000000,9999999);
for ($x = 1; $x <= 3; $x++) {
$generated_telephones[$x] = rand(1000000,9999999);
}

to generate 3 random telephone numbers works, but it is too simple to identify the correct number.

F.e. the original randomized number 9876543 - the desired result similar to - 9865742, 8896558, 9586543




Aucun commentaire:

Enregistrer un commentaire