当前位置:网站首页>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;
}
边栏推荐
- Circuitbreaker fuse of resilience4j - Summary
- OpenCV中CLAHE用于16位图像增强显示
- tp6调试(trace)
- PLC如何自行构造移位功能块(FC)
- Explanation of the principle of MySQL's leftmost matching principle
- Why is cross-border e-commerce so popular? Papaya mobile takes you to find out
- pycharm 查看opencv当前的版本
- [CEGUI] font loading optimization
- Jetpack architecture component learning (3) -- activity results API usage
- Papaya Mobile has a comprehensive layout of cross-border e-commerce SaaS papaya orange. What are the opportunities for this new track?
猜你喜欢
![Data processing and visualization of machine learning [iris data classification | feature attribute comparison]](/img/a3/1d181b9dd5268e13cc276a78862d1f.png)
Data processing and visualization of machine learning [iris data classification | feature attribute comparison]
![[Wayland] Wayland introduction and customized guidance](/img/4e/655d484ca7787f39aab446fdb1ae74.jpg)
[Wayland] Wayland introduction and customized guidance

CentOS 7 installing MySQL 8

tp6调试(trace)

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

conda 安装tensorflow 测试tensorflow

HALCON联合C#检测表面缺陷——仿射变换(三)

极速搭建元宇宙画廊 #oncyber.io

【926. 将字符串翻转到单调递增】
![[Wayland] Weston multi screen display](/img/58/698e2cc790d3dbef9260cb2ad690d8.jpg)
[Wayland] Weston multi screen display
随机推荐
[CEGUI] font resource loading process
High performance computing framework for image processing
Auto. JS learning note 10: instantiate a custom object and use json The stringify() method causes an error (resolved)
PostgreSQL uses stored procedures to splice multiple tables and query data
2021-03-26
FPGA VGA display based on de2-115 platform
C break continue return
Student management system
2021-02-21
np.meshgrid()函数 以及 三维空间中的坐标位置生成 以及 numpy.repeat()函数介绍
JVM (III) Virtual machine performance monitoring & fault handling tool
VSCode代码调试技巧
Raw socket usage
Pycharm view the current version of opencv
性能指标的信仰危机
properties中文乱码
不需要安装防毒软件的系统Chromebook
【926. 将字符串翻转到单调递增】
机器学习不是你想用,想用就能用
3. Abstract Factory