当前位置:网站首页>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)边栏推荐
- Possible causes of runtime error
- ORA-01547、ORA-01194、ORA-01110
- Continuous assignment of Verilog procedure
- Kotlin基础学习 17
- Global and Chinese market of autotransfusion bags 2022-2028: Research Report on technology, participants, trends, market size and share
- Merge interval, linked list, array
- 旋转框目标检测mmrotate v0.3.1 学习模型
- 数据传输中的成帧
- Go执行shell命令
- Qualcomm platform WiFi -- P2P issue (2)
猜你喜欢

OSPF LSA message parsing (under update)

Uniapp uses canvas to generate posters and save them locally

Render header usage of El table

命名块 verilog

The capacity is upgraded again, and the new 256gb large capacity specification of Lexar rexa 2000x memory card is added

Tupu software has passed CMMI5 certification| High authority and high-level certification in the international software field

小米青年工程师,本来只是去打个酱油

Exchange rate query interface

Force deduction daily question 540 A single element in an ordered array

初出茅庐市值1亿美金的监控产品Sentry体验与架构
随机推荐
ZABBIX API creates hosts in batches according to the host information in Excel files
Gradle 笔记
PHP array processing
Verilog 过程连续赋值
Find duplicates [Abstract binary / fast and slow pointer / binary enumeration]
Discussion on related configuration of thread pool
《MATLAB 神经网络43个案例分析》:第42章 并行运算与神经网络——基于CPU/GPU的并行神经网络运算
[HCIA continuous update] overview of dynamic routing protocol
创业了...
One of the future trends of SAP ui5: embrace typescript
Verilog state machine
Yan Rong looks at how to formulate a multi cloud strategy in the era of hybrid cloud
JS introduction < 1 >
Common means of modeling: aggregation
3048. Number of words
Global and Chinese markets for welding equipment and consumables 2022-2028: Research Report on technology, participants, trends, market size and share
< job search> process and signal
C # joint Halcon's experience of breaking away from Halcon environment and various error reporting solutions
MSI announced that its motherboard products will cancel all paper accessories
Design details of SAP e-commerce cloud footernavigationcomponent