Randomly generate unique numbers
Randomly produces a unique 6-digit number and corresponding 12-digit number. For example: 10,000 required
Such as:
244855 587753043808
558676 168139952943
------Solution--------------------
The random out of the data recorded, the next random time than the right, temporarily only think of such a method, but very troublesome, know there are other ways not ....
------Solution--------------------
for ($i =10000; $i <=99999; $i + +) {
Echo "244855 5877530{$i}
";
}
------Solution--------------------
You can build this
PHP Code
for ($i =0; $i <30000; $i + +) {//Generate 30,000 6-digit $r [] = rand (100000, 999999);} if (Count (Array_flip (Array_count_values ($r))) >1) {//Check for duplicate exit (' Duplicate, re-execute ');} foreach (Array_chunk ($r, 3) as $t) {//Cut into 3 groups of $res [] = array ($t [0], $t [1]. $t [2]);//Put in an array, you save}print_r ($res) according to your needs;
------Solution--------------------
discuss
PHP Code
$check = Array ();
for ($i =0; $i <30000; $i + +)
{
Do
{
$rnum = rand (100000, 999999);
}
while (Isset ($check [$rnum]);
$check [$rnum] = 1;
}
Print_r (Array_keys ($check));
This is a build of 10,000 not ...
------Solution--------------------
PHP code
!--? phps = range (100000,999999); Srand (( float) microtime () *1000000); Shuffle (s); $i = 10000;foreach (s as) {if ($i--0) break; echo "\ r \ n";}? -->