Random generation of unique numbers random generation of unique 6 digits and corresponding 12 digits. for example, we need 10 thousand such as: 244855587753043808558676168139952943 ------ solution ------------------ to record the random data and generate a unique number randomly.
Random generation of unique 6-digit numbers and corresponding 12-digit numbers. for example, 10 thousand digits are required.
For example:
244855 587753043808
558676 168139952943
------ Solution --------------------
Record the random data and compare it at random next time. for now, I only think of this method, but it is very troublesome. I know there are other methods ....
------ Solution --------------------
For ($ I = 10000; $ I <= 99999; $ I ++ ){
Echo "244855 5877530 {$ I}
";
}
------ Solution --------------------
You can generate
PHP code
For ($ I = 0; $ I <30000; $ I ++) {// generates 30 thousand 6-digit digits $ r [] = rand (100000,999 999 );} if (count (array_flip (array_count_values ($ r)> 1) {// Check for repeated exit ('repeated, re-execute ');} foreach (array_chunk ($ r, 3) as $ t) {// cut into three groups $ res [] = array ($ t [0], $ t [1]. $ t [2]); // put it in an array and you can save it as needed} print_r ($ res );
------ Solution --------------------
Discussion
PHP code
$ Check = array ();
For ($ I = 0; I I <30000; $ I ++)
{
Do
{
$ Rnum = rand (100000,999 999 );
}
While (isset ($ check [$ rnum]);
$ Check [$ rnum] = 1;
}
Print_r (array_keys ($ check ));
This generates 10 thousand no ......
------ Solution --------------------
PHP code