当前位置:网站首页>PHP wechat red packet grabbing algorithm
PHP wechat red packet grabbing algorithm
2022-07-02 22:28:00 【Game programming】
php Wechat red packet algorithm
function qiangHongbao() { $total=10;// Total $num=8;// Divide into 8 Red envelopes , Support 8 People receive at random $min=0.01;// Everyone can at least receive 0.01 element for ($i=1;$i<$num;$i++) { $safe_total=($total-($num-$i)*$min)/($num-$i);// Random safety upper limit $money=mt_rand($min*100,$safe_total*100)/100; $total=$total-$money; echo ' The first '.$i.' Red envelopes :'.$money.' element , balance :'.$total.' element <br/>'; } echo ' The first '.$num.' Red envelopes :'.$total.' element , balance :0 element '; }// Output results // The first 1 Red envelopes :0.08 element , balance :9.92 element // The first 2 Red envelopes :0.82 element , balance :9.1 element // The first 3 Red envelopes :1.4 element , balance :7.7 element // The first 4 Red envelopes :0.87 element , balance :6.83 element // The first 5 Red envelopes :1.07 element , balance :5.76 element // The first 6 Red envelopes :2.47 element , balance :3.29 element // The first 7 Red envelopes :1.01 element , balance :2.28 element // The first 8 Red envelopes :2.28 element , balance :0 element author :. Week week
Game programming , A game development favorite ~
If the picture is not displayed for a long time , Please use Chrome Kernel browser .
边栏推荐
- Une semaine de vie
- U++ 学习笔记 ----松弛
- Unity3d learning notes 4 - create mesh advanced interface
- [shutter] shutter application theme (themedata | dynamic modification theme)
- App page sharing password rails implementation
- Market Research - current market situation and future development trend of total nutrition products
- Pointer - function pointer
- Unity3d learning notes 4 - create mesh advanced interface
- 《ActBERT》百度&悉尼科技大学提出ActBERT,学习全局局部视频文本表示,在五个视频-文本任务中有效!
- 【leetcode】1380. Lucky number in matrix
猜你喜欢

Kubernetes resource object introduction and common commands (4)

An overview of the development of affective computing and understanding research

图像基础概念与YUV/RGB深入理解
![[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)

Sql service intercepts string

#include errors detected. Please update your includePath.

地理探测器原理介绍

Daily book -- analyze the pain points of software automation from simple to deep

pip安装whl文件报错:ERROR: ... is not a supported wheel on this platform

About test cases
随机推荐
GEE:(二)对影像进行重采样
关于PHP-数据库的 数据读取,Trying to get property 'num_rows' of non-object?
图像基础概念与YUV/RGB深入理解
Market Research - current situation and future development trend of anti-counterfeiting label market
Oriental Aesthetics and software design
SQL必需掌握的100个重要知识点:使用游标
Lightgbm principle and its application in astronomical data
[shutter] shutter application life cycle (foreground state resumed | background state paused | inactive | component separation state detached)
20220702 how do programmers build knowledge systems?
[Jianzhi offer] 57 And are two numbers of S
sql service 截取字符串
C语言,实现三子棋小游戏
C language, to achieve three chess games
U++ 原始内存 学习笔记
VIM command-t plugin error: unable to load the C extension - VIM command-t plugin error: could not load the C extension
Market Research - current market situation and future development trend of night vision goggles for pilots
CVPR论文解读 | 弱监督的高保真服饰模特生成
Interpretation of CVPR paper | generation of high fidelity fashion models with weak supervision
基于ASP.net的手机销售管理系统(二手手机销售管理系统)+ASP.NET+C#语言+VS2010+数据库可以用于课设、毕设学习
[shutter] shutter gesture interaction (click event handling | click OnTap | double click | long press | click Cancel | press ontapdown | lift ontapup)