PHP generates 16 digit random number, PHP16 bit random number
PHP generates 16-bit only numeric random number
Share a PHP code that generates 16-bit random numbers, and PHP generates two ways to generate random numbers.
Method 1,
PHP$amt_rand(10000000,99999999); $b Mt_rand (10000000,99999999); Echo $a. $b;
Method 2:
PHP$arange(0,9); for ($i= 0; $i<16; $i+ +) {$barray_rand($a);}//Www.yuju100.com Var_dump (Join("",$b)); // result String (+) "0179571910024734"
A complete set of PHP code +html PHP randomly generated 10 digits, and never repeat, in a single-line text box output
$result =random (10);//Generate 10-bit random numbers
$result =random (123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ);//Generate 10-bit alphanumeric mixed string
echo "";
/**
* Generate random string
*
* @param int $length output length
* @param string $chars Optional, default is 0123456789
* @return String string
*/
function random ($length, $chars = ' 0123456789 ') {
$hash = ";
$max = strlen ($chars)-1;
for ($i = 0; $i < $length; $i + +) {
$hash. = $chars [Mt_rand (0, $max)];
}
return $hash;
}
?>
A PHP code that generates four-bit random numbers
Four-bit random number of pure digits
rand (1000,9999)
number and character mash-up four-bit random string:
Function Getrandstr ($len)
{
$ chars = Array (
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K",
"L", "M", "N", "O", "P", "Q", "R", "s", "t "," U "," V ",
" W "," X "," Y "," Z "," A "," B "," C "," D "," E "," F "," G ",
" H "," I "," J "," K "," L "," M "," N "," O "," P ", "Q", "R",
"S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2",
"3", "4", "5", "6", "7", "8", "9"
);
$charsLen = count ($chars)-1;
Shuffle ($chars);
$output = "";
for ($i =0; $i < $len; $i + +)
{
$output. = $chars [Mt_rand (0, $charsLen)];
}
Return $output;
}
Echo getrandstr (4);
http://www.bkjia.com/PHPjc/878339.html www.bkjia.com true http://www.bkjia.com/PHPjc/878339.html techarticle PHP generates a 16-bit random number of digits, and the PHP16 bit number PHP generates 16 bits with only the number random number to share a PHP generated 16-bit random number of code, PHP generates a random number of two methods. Method ...