/crmeb/app/services/activity/bargain/StoreBargainUserHelpServices.php 160行
public function randomFloat($price, $people, $type = false)
{
// 按照人数计算保留金额
$retainPrice = bcmul((string)$people, '0.01', 2);
// 实际剩余金额
$price = bcsub((string)$price, $retainPrice, 2);
// 每人可砍掉的最大金额
$maxCut = bcdiv($price, (string)$people, 2);
// 设置一个最小砍价金额,避免过多 0.01
$minCut = max('0.01', bcdiv($price, (string)(2 * $people), 2)); // 动态计算最小砍价金额
// 随机生成每人砍掉的金额
$cutPrice = bcmul((string)mt_rand((int)($minCut * 100), (int)($maxCut * 100)), '0.01', 2);
// 确保返回的砍价金额不为 0.00
return $cutPrice != '0.00' ? $cutPrice : '0.01';
}