/**
* Generate random string
*
* generates a random string of a specified length and returns it to the user
*
* @access Public
* @param int $len The number of bits generated by the string
* @return String
*/
function Randstr ($len =6) {
$chars = ' abdefghjklmnpqrstvwxyabdefghijkmnpqrstvwxy23456789#%* '; Characters to build the password from
Mt_srand (Double) Microtime () *1000000*getmypid ()); Seed the random number generater (must is done)
$password = ";
while (strlen ($password) < $len)
$password. =substr ($chars, (Mt_rand ()%strlen ($chars)), 1);
return $password;
}
?>
http://www.bkjia.com/PHPjc/317275.html www.bkjia.com true http://www.bkjia.com/PHPjc/317275.html techarticle ? PHP/** * Generates a random string * * generates a random string of a specified length and returns to the user * * @accesspublic * @paramint $len the number of digits generated by the string * @returnstring */functionra...