当前位置:网站首页>JS generate random numbers
JS generate random numbers
2022-07-02 03:24:00 【onYang】
const getNum = (andNum, Num) => {
//andNum Sum of random numbers ,Num Number of random numbers
var randomNum = new Array()
let sum = 0
for (var i=0;i<Num-1;i++)
{
x = Math.floor(Math.random() * (andNum - sum))
randomNum[i] = x
sum += x
}
randomNum[Num-1] = andNum - sum
return randomNum
}
getNum(50,6)
边栏推荐
- OSPF LSA message parsing (under update)
- verilog REG 寄存器、向量、整数、实数、时间寄存器
- Exchange rate query interface
- KL divergence is a valuable article
- What is hybrid web containers for SAP ui5
- Qualcomm platform WiFi -- Native crash caused by WiFi
- Calculation of page table size of level 2, level 3 and level 4 in protection mode (4k=4*2^10)
- aaaaaaaaaaaaa
- Verilog 时序控制
- [JVM] detailed description of the process of creating objects
猜你喜欢
Cache processing scheme in high concurrency scenario
On redis (II) -- cluster version
Just a few simple steps - start playing wechat applet
GB/T-2423.xx 环境试验文件,整理包括了最新的文件里面
C shallow copy and deep copy
《MATLAB 神经网络43个案例分析》:第41章 定制神经网络的实现——神经网络的个性化建模与仿真
SAML2.0 notes (I)
表单自定义校验规则
MySQL connection query and subquery
初出茅庐市值1亿美金的监控产品Sentry体验与架构
随机推荐
Calculation of page table size of level 2, level 3 and level 4 in protection mode (4k=4*2^10)
This article describes the step-by-step process of starting the NFT platform project
Docker installs canal and MySQL for simple testing and implementation of redis and MySQL cache consistency
Render header usage of El table
Verilog parallel block implementation
寻找重复数[抽象二分/快慢指针/二进制枚举]
Possible causes of runtime error
Intersection vengraph
MSI announced that its motherboard products will cancel all paper accessories
Competition and adventure burr
Pointer array & array pointer
【JVM】创建对象的流程详解
In depth interpretation of pytest official documents (26) customized pytest assertion error information
tarjan2
Use blocking or non blocking for streamline
[数据库]JDBC
Discussion on related configuration of thread pool
《MATLAB 神经网络43个案例分析》:第41章 定制神经网络的实现——神经网络的个性化建模与仿真
verilog REG 寄存器、向量、整数、实数、时间寄存器
verilog 并行块实现