function setRangeRandom(min, max) { //在范围内生成随机数
let n = max - min;
if (n == 0) {
return max
} else if (n < 0) {
[max, min] = [min, max];
n = Math.abs(n);
}
return ((Math.random() * ++n) >> 0) + min;
}
console.log(setRangeRandom(3,23))