What should I do if I want to generate a random number of seventy or eighty digits?
To solve this problem, I wrote a function.
function rand_num($num = 1){
$num = (int) $num;
$rand = '';
if($num > 1){
for($i=0;$i<$num;$i++){
$rand = $rand . mt_rand(1,9);
}
return $rand;
}else{
return mt_rand(0,9);
}
}
What about this function. It’s also very simple, you can get it if you need it.
Calling the method is naturally rand_num (the number of digits you want)