php对应js的Math.random()

<?php

function random($min = 0, $max = 1)
{
    return $min + mt_rand()/mt_getrandmax()*($max-$min);
}