题解 | #无重复数组#
无重复数组
https://www.nowcoder.com/practice/d2fa3632268b41df9bc417b74802ad8c
{"css":"","js":"","html":"<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n </head>\n <body>\n\n <script>\n const _getUniqueNums = (start,end,n) => {\n let _set = new Set();\n let arr = new Array();\n do{\n _set.add(Math.floor(Math.random()*(end-start)+1)+start);\n } while(_set.size < n);\n _set.forEach(item=>{\n arr.push(item);\n })\n return arr\n \n }\n </script>\n </body>\n</html>","libs":[]}