当前位置:网站首页>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》阅读感受
- 100 important knowledge points that SQL must master: management transaction processing
- :last-child 不生效解决
- Unity3d learning notes 4 - create mesh advanced interface
- From "bronze" to "King", there are three secrets of enterprise digitalization
- The neo4j skill tree was officially released to help you easily master the neo4j map database
- Summary of the first week of summer vacation
- VIM command-t plugin error: unable to load the C extension - VIM command-t plugin error: could not load the C extension
- Official announcement! The golden decade of new programmers and developers was officially released
- 关于PHP-数据库的 数据读取,Trying to get property 'num_rows' of non-object?
猜你喜欢
[shutter] shutter resource file use (import resource pictures | use image resources)
[shutter] shutter page Jump (route | navigator | page close)
Etcd raft protocol
C语言,实现三子棋小游戏
Basic IO interface technology - microcomputer Chapter 7 Notes
*C language final course design * -- address book management system (complete project + source code + detailed notes)
关于测试用例
From "bronze" to "King", there are three secrets of enterprise digitalization
PIP version update timeout - download using domestic image
《ActBERT》百度&悉尼科技大学提出ActBERT,学习全局局部视频文本表示,在五个视频-文本任务中有效!
随机推荐
【剑指 Offer】57. 和为s的两个数字
Market Research - current situation and future development trend of anti-counterfeiting label market
"New programmer 003" was officially launched, and the cloud native and digital practical experience of 30+ companies such as Huawei and Alibaba
Basic concepts of image and deep understanding of yuv/rgb
将 EMQX Cloud 数据通过公网桥接到 AWS IoT
20220702-程序员如何构建知识体系?
pip安装whl文件报错:ERROR: ... is not a supported wheel on this platform
Etcd Raft 协议
[shutter] shutter application life cycle (foreground state resumed | background state paused | inactive | component separation state detached)
Web侧防御指南
Pointer and string
Promise optimized callback hell
Ransack组合条件搜索实现
Unity3D学习笔记4——创建Mesh高级接口
Blue Bridge Cup Eliminate last one (bit operation, code completion)
在beforeDestroy中销毁localStorage中的值无效
Riding the wind of "cloud native" and stepping on the wave of "digitalization", new programmer 003 starts pre-sale
"Actbert" Baidu & Sydney University of technology proposed actbert to learn the global and local video text representation, which is effective in five video text tasks!
[C question set] of V
How to write a good program when a big book speaks every day?