当前位置:网站首页>PHP微信抢红包的算法
PHP微信抢红包的算法
2022-07-02 22:00:00 【游戏编程】
php微信红包算法
function qiangHongbao() { $total=10;//总额 $num=8;// 分成8个红包,支持8人随机领取 $min=0.01;//每个人最少能收到0.01元 for ($i=1;$i<$num;$i++) { $safe_total=($total-($num-$i)*$min)/($num-$i);//随机安全上限 $money=mt_rand($min*100,$safe_total*100)/100; $total=$total-$money; echo '第'.$i.'个红包:'.$money.' 元,余额:'.$total.' 元 <br/>'; } echo '第'.$num.'个红包:'.$total.' 元,余额:0 元'; }// 输出结果// 第1个红包:0.08 元,余额:9.92 元// 第2个红包:0.82 元,余额:9.1 元// 第3个红包:1.4 元,余额:7.7 元// 第4个红包:0.87 元,余额:6.83 元// 第5个红包:1.07 元,余额:5.76 元// 第6个红包:2.47 元,余额:3.29 元// 第7个红包:1.01 元,余额:2.28 元// 第8个红包:2.28 元,余额:0 元作者:.周周
游戏编程,一个游戏开发收藏夹~
如果图片长时间未显示,请使用Chrome内核浏览器。
边栏推荐
- Web侧防御指南
- "New programmer 003" was officially launched, and the cloud native and digital practical experience of 30+ companies such as Huawei and Alibaba
- [shutter] shutter opens a third-party application (url|launcher plug-in search and installation | url| launcher plug-in official example | open browser | open a third-party application)
- Etcd raft protocol
- scrcpy这款软件解决了和同事分享手机屏幕的问题| 社区征文
- Technological Entrepreneurship: failure is not success, but reflection is
- Daily book - low code you must understand in the era of digital transformation
- 技术人创业:失败不是成功,但反思是
- [Jianzhi offer] 57 And are two numbers of S
- Learn computer knowledge from scratch
猜你喜欢

How to prevent your jar from being decompiled?

A specially designed loss is used to deal with data sets with unbalanced categories

540. Single element in ordered array
![[shutter] shutter opens a third-party application (url|launcher plug-in search and installation | url| launcher plug-in official example | open browser | open a third-party application)](/img/f7/cb41d159e5c5ef3f4f1b9468d52ccc.jpg)
[shutter] shutter opens a third-party application (url|launcher plug-in search and installation | url| launcher plug-in official example | open browser | open a third-party application)

Pointer and string

Daily book CSO advanced road first exposed

【零基础一】Navicat下载链接
![[shutter] shutter custom fonts (download TTF fonts | pubspec.yaml configure font resources | synchronize resources | globally apply fonts | locally apply fonts)](/img/27/8594ba0b49d5008b7469967babed17.jpg)
[shutter] shutter custom fonts (download TTF fonts | pubspec.yaml configure font resources | synchronize resources | globally apply fonts | locally apply fonts)

The source code of the daily book analyzes the design idea of Flink and solves the problems in Flink
![[shutter] shutter page Jump (route | navigator | page close)](/img/af/3fb2ca18bcec23a5c0c6897570fb53.gif)
[shutter] shutter page Jump (route | navigator | page close)
随机推荐
20220702 how do programmers build knowledge systems?
【剑指 Offer】57. 和为s的两个数字
pip安装whl文件报错:ERROR: ... is not a supported wheel on this platform
[shutter] shutter opens a third-party application (url|launcher plug-in search and installation | url| launcher plug-in official example | open browser | open a third-party application)
Summary of the first week of summer vacation
[sword finger offer] 56 - I. the number of numbers in the array
发现你看不到的物体!南开&武大&ETH提出用于伪装目标检测SINet,代码已开源!...
Etcd raft protocol
Unity3D学习笔记4——创建Mesh高级接口
关于测试用例
: last child does not take effect
Infrastructure is code: a change is coming
Pointer and string
Ransack组合条件搜索实现
"New programmer 003" was officially launched, and the cloud native and digital practical experience of 30+ companies such as Huawei and Alibaba
APP页面分享口令Rails实现
2019 Nanchang (relive the classic)
An overview of the development of affective computing and understanding research
Read a doctor, the kind that studies cows! Dr. enrollment of livestock technology group of Leuven University, milk quality monitoring
MySQL inserts Chinese data and reports an error. Set the default collation