主页 > php易尔灵网络科技

php 拼手气红包

213 2024-03-07 23:30

php function generateLuckMoney($totalAmount, $totalPeople){ $remainAmount = $totalAmount; $remainPeople = $totalPeople; $moneyList = []; for ($i = 1; $i < $totalPeople; $i++) { $average = $remainAmount / $remainPeople; $money = rand(1, $average * 2 - 1); $remainAmount -= $money; $remainPeople--; $moneyList[] = $money; } $moneyList[] = $remainAmount; return $moneyList; } $luckMoneyList = generateLuckMoney(100, 10); foreach($luckMoneyList as $money){ echo "

抢到的红包金额:" . $money . " 元

"; }
顶一下
(0)
0%
踩一下
(0)
0%
相关评论
我要评论
点击我更换图片

热点提要

网站地图 (共30个专题140539篇文章)

返回首页