0到1之间的随机数
function _rand(){ $num = rand(); if($num != 0){ return $num; } _rand();}$n = _rand();echo $n/($n+_rand());?>还有一种方式也很好的。while($n == 0 || $u==0){$n = rand();$u = rand();}echo $n/($n+$u);