当前位置:网站首页>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内核浏览器。
边栏推荐
- 《Just because》阅读感受
- Market Research - current market situation and future development trend of marine wet exhaust hose
- [shutter] shutter layout component (wrap component | expanded component)
- 在beforeDestroy中销毁localStorage中的值无效
- Web侧防御指南
- LandingSite eBand B1冒烟测试用例
- 将 EMQX Cloud 数据通过公网桥接到 AWS IoT
- Etcd raft protocol
- GEE:(二)对影像进行重采样
- Five message formats of OSPF
猜你喜欢

Kubernetes resource object introduction and common commands (4)

Infrastructure is code: a change is coming

Scrcpy this software solves the problem of sharing mobile screen with colleagues | community essay solicitation

Basic IO interface technology - microcomputer Chapter 7 Notes

Oriental Aesthetics and software design

Ransack组合条件搜索实现

C语言,实现三子棋小游戏

"New programmer 003" was officially launched, and the cloud native and digital practical experience of 30+ companies such as Huawei and Alibaba

Evolution of messaging and streaming systems under the native tide of open source cloud

Daily book - low code you must understand in the era of digital transformation
随机推荐
Service visibility and observability
*C language final course design * -- address book management system (complete project + source code + detailed notes)
Reading experience of just because
Basic concepts of image and deep understanding of yuv/rgb
ArrayList分析2 :Itr、ListIterator以及SubList中的坑
ServiceMesh主要解决的三大痛點
: last child does not take effect
【零基础一】Navicat下载链接
[shutter] shutter custom fonts (download TTF fonts | pubspec.yaml configure font resources | synchronize resources | globally apply fonts | locally apply fonts)
Five message formats of OSPF
How do I access the kubernetes API?
GEE:(二)对影像进行重采样
Daily book - low code you must understand in the era of digital transformation
Kubernetes resource object introduction and common commands (4)
Official announcement! The golden decade of new programmers and developers was officially released
Blue Bridge Cup Winter vacation homework (DFS backtracking + pruning)
Market Research - current situation and future development trend of anti-counterfeiting label market
VIM command-t plugin error: unable to load the C extension - VIM command-t plugin error: could not load the C extension
Attack and defense world PWN question: Echo
Unity3D学习笔记4——创建Mesh高级接口