Random numbe with precision
<?php
function frand($min, $max, $precision = 1) {
$scale = 1/$precision;
return mt_rand($min * $scale, $max * $scale) / $scale;
}
echo "frand(0, 10, 0.25) = " . frand(0, 10, 0.25) . "\n";
?>
Related examples in the same category