当前位置:网站首页>PHP wechat red packet allocation logic
PHP wechat red packet allocation logic
2022-06-12 10:20:00 【Qu Shuai 369】
/**
* @param $total Total money
* @param $n The total number of
* @return array
*/
function rand_red($total,$n) {
$arr = array();
for ($i=$n;$i>=2;$i--) {
$v = rand(1,(int)($total*2/$i)-1);
$total -= $v;
$arr[] = $v;
}
$arr[] = $total;
return $arr;
}
边栏推荐
- one
- JVM (III) Virtual machine performance monitoring & fault handling tool
- Tp6 debugging (trace)
- JVM (IV) Class file structure (complete parsing of bytecode attached)
- 2021-09-13
- Pycharm view the current version of opencv
- Chapter 3 search
- [Mozilla] basic concept analysis of IPDL
- 【实验】MySQL主从复制及读写分离
- [CEGUI] font resource loading process
猜你喜欢

Oculus quest generation opens Bluetooth connection

MySQL 4 Database table storage structure & tablespace

MYSQL的最左匹配原则的原理讲解

JVM (VI) Virtual machine bytecode execution engine (with stack execution process and bytecode instruction table)

Circuitbreaker fuse of resilience4j - Summary

Implementation principle of redisson distributed lock

1268_FreeRTOS任务上下文切换的实现

Basic use of scratch

JVM (V) Virtual machine class loading (parental delegation mechanism)

数组,整型,字符变量在全局和局部的存在形式
随机推荐
OpenCV中CLAHE用于16位图像增强显示
Pandorabox uses firewall rules to define non internet time
Oculus quest generation opens Bluetooth connection
Circuitbreaker fuse of resilience4j - Summary
[Wayland] Weston startup process analysis
Auto. JS learning note 4: after autojs is packaged, most Huawei and other big brand mobile phones cannot be installed? This problem can be solved by using the simulator to remotely sign and package in
Qt自定义窗口圆角
Implementation principle of redisson distributed lock
High performance computing framework for image processing
How Qualcomm platform modifies special voltage
Research on autojs wechat: the control IP in wechat on different versions of wechat or simulators is different.
Propagation of transactions
pycharm 查看opencv当前的版本
ASP.NET Core权限系统实战(零)
properties中文乱码
One test for twoorthree years, recording some thoughts on test exchange experience
2021-02-12
Checkpoint of the four cornerstones of Flink
极速搭建元宇宙画廊 #oncyber.io
[926. flip the string to monotonic increment]