/**
*功能:在规定次数中随机分配指定金额
*$total:需要分配的金额
*$num:需要分配的次数
*$min:需要分配的最小金额
*/
function randNum($total=200,$num=17,$min=1) {
for ($i=1;$i<$num;$i++) {
$safe_total = ($total - ($num-$i)*$min) / ($num-$i);//随机安全上限
if($safe_total < $min) $safe_total = $min;
$money = round(mt_rand($min*100,$safe_total*100)/100);
$total = $total - $money;
$data[] = round($money,2);
}
$data[] = round($total);
shuffle($data);
return $data;
}