当前位置:网站首页>js生成随机数
js生成随机数
2022-07-02 03:21:00 【onYang】
const getNum = (andNum, Num) => {
//andNum随机数之和,Num随机数个数
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)
边栏推荐
- 图扑软件通过 CMMI5 级认证!| 国际软件领域高权威高等级认证
- venn圖取交集
- Global and Chinese markets for electronic laryngoscope systems 2022-2028: Research Report on technology, participants, trends, market size and share
- Verilog wire type
- 流线线使用阻塞还是非阻塞
- Qualcomm platform WiFi -- Native crash caused by WiFi
- 自定义组件的 v-model
- How to establish its own NFT market platform in 2022
- Gradle notes
- JS <2>
猜你喜欢
QT environment generates dump to solve abnormal crash
Just a few simple steps - start playing wechat applet
A list of job levels and salaries in common Internet companies. Those who have conditions must enter big factories. The salary is really high
The capacity is upgraded again, and the new 256gb large capacity specification of Lexar rexa 2000x memory card is added
图扑软件通过 CMMI5 级认证!| 国际软件领域高权威高等级认证
Docker installs canal and MySQL for simple testing and implementation of redis and MySQL cache consistency
Pointer array & array pointer
浅谈线程池相关配置
buu_ re_ crackMe
Force deduction daily question 540 A single element in an ordered array
随机推荐
Use blocking or non blocking for streamline
Baohong industry | what misunderstandings should we pay attention to when diversifying investment
Verilog 避免 Latch
In depth interpretation of pytest official documents (26) customized pytest assertion error information
终日乾乾,夕惕若厉
Qualcomm platform WiFi -- P2P issue (2)
Form custom verification rules
Golang configure export goprivate to pull private library code
aaaaaaaaaaaaa
SAML2.0 笔记(一)
/silicosis/geo/GSE184854_ scRNA-seq_ mouse_ lung_ ccr2/GSE184854_ RAW/GSM5598265_ matrix_ inflection_ demult
Mathematical calculation in real mode addressing
C#联合halcon脱离halcon环境以及各种报错解决经历
h5中的页面显示隐藏执行事件
PHP array processing
跟着CTF-wiki学pwn——ret2shellcode
Global and Chinese market of bone adhesives 2022-2028: Research Report on technology, participants, trends, market size and share
Framing in data transmission
Possible causes of runtime error
verilog 并行块实现