/**
* selectRandomArr 获得规定范围内的n个不重复的随机数
* lowValue 取值范围的下限
* highValue 取值范围的下限
* number 取值个数
*
*/
selectRandomArr = (lowValue, highValue, number) => {
return new Array(highValue)
.fill(0)
.map((v, i) => i + 1 + lowValue)
.sort(() => 0.5 - Math.random())
.filter((v, i) => i < number)
}
// 获得单个随机数
selectRandom = (lowValue, highValue) => {
var choice = highValue - lowValue + 1
return (Math.floor(Math.random() * choice + lowValue))
}