当前位置:网站首页>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内核浏览器。
边栏推荐
- 加了定位的文字如何水平垂直居中
- Bridge emqx cloud data to AWS IOT through the public network
- Basic IO interface technology - microcomputer Chapter 7 Notes
- Market Research - current market situation and future development trend of third-party data platform
- Introduction to victoriametrics
- [shutter] shutter gesture interaction (click event handling | click OnTap | double click | long press | click Cancel | press ontapdown | lift ontapup)
- Une semaine de vie
- Pyqt picture decodes and encodes and loads pictures
- APP页面分享口令Rails实现
- sql service 截取字符串
猜你喜欢

Technical solution of vision and manipulator calibration system

Tencent three sides: in the process of writing files, the process crashes, and will the file data be lost?

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

Ransack combined condition search implementation

Riding the wind of "cloud native" and stepping on the wave of "digitalization", new programmer 003 starts pre-sale

How to prevent your jar from being decompiled?

20220702-程序员如何构建知识体系?
![[shutter] shutter page Jump (route | navigator | page close)](/img/af/3fb2ca18bcec23a5c0c6897570fb53.gif)
[shutter] shutter page Jump (route | navigator | page close)

Blue Bridge Cup Winter vacation homework (DFS backtracking + pruning)

Kubernetes resource object introduction and common commands (4)
随机推荐
pip安裝whl文件報錯:ERROR: ... is not a supported wheel on this platform
Detailed explanation of OSI seven layer model
【剑指 Offer 】56 - II. 数组中数字出现的次数 II
Market Research - current market situation and future development trend of marine wet exhaust hose
CVPR论文解读 | 弱监督的高保真服饰模特生成
【leetcode】1380. Lucky number in matrix
VictoriaMetrics 简介
Introduction to victoriametrics
Etcd raft protocol
Technological Entrepreneurship: failure is not success, but reflection is
Pip install whl file Error: Error: … Ce n'est pas une roue supportée sur cette plateforme
The difference between include < > and include ""
Unity3D学习笔记4——创建Mesh高级接口
APP页面分享口令Rails实现
Evolution of messaging and streaming systems under the native tide of open source cloud
Lightgbm principle and its application in astronomical data
《ActBERT》百度&悉尼科技大学提出ActBERT,学习全局局部视频文本表示,在五个视频-文本任务中有效!
地理探测器原理介绍
Web侧防御指南
Five message formats of OSPF