题解 | #无重复数组#
无重复数组
https://www.nowcoder.com/practice/d2fa3632268b41df9bc417b74802ad8c
const _getUniqueNums = (start, end, n) => { let arr=[]; for (let i = 0; i < n; i++) { let a = Math.floor(Math.random() * (end - start + 1) + start); arr.push(a) } if(Array.from(new Set(arr)).length < arr.length){ _getUniqueNums(start, end, n) }else{ return arr } }