Home >Backend Development >PHP Tutorial > php生成零到1(小数)的随机数
php生成0到1(小数)的随机数
function randomFloat($min = 0, $max = 1) { return $min + mt_rand() / mt_getrandmax() * ($max - $min); }
?
原文网站:http://www.php.net/manual/en/function.mt-getrandmax.php