function randomFloat($min = 0, $max = 1) { $rand = mt_rand(); $lmax = mt_getrandmax(); return $min + $rand / $lmax * ($max - $min); } var_dump(randomFloat());
var_dump(randomFloat(1, 100000));
随机浮点数函数!
function randomFloat($min = 0, $max = 1) { $rand = mt_rand(); $lmax = mt_getrandmax(); return $min + $rand / $lmax * ($max - $min); } var_dump(randomFloat());
var_dump(randomFloat(1, 100000));
随机浮点数函数!