题解 | #无重复数组#
无重复数组
https://www.nowcoder.com/practice/d2fa3632268b41df9bc417b74802ad8c
const _getUniqueNums = (start, end, n) => {
// 补全代码
let arrMath = [];
for (let i = 0; i <= n; i++) {
if (arrMath.length <= n) {
let temp = Math.floor(Math.random() * (start - end)) + end;
if (arrMath.indexOf(temp) == -1) {
arrMath[arrMath.length] = temp;
temp = '';
}
}
}
return arrMath;
}
