const indRandom = (n, maxValue, minValue = 0) => {
const nNumArray = [...Array(maxValue + 1).keys()];
const resultArray = [];
for (let i = 0; i < n; i++) {
const randomNum = Math.floor((Math.random() * (((maxValue - minValue) + 1) - i)) + minValue);
resultArray.push(nNumArray[randomNum]);
nNumArray.splice(randomNum, 1);
}
console.log(resultArray);
return resultArray;
};
indRandom(5, 10000);
梵蒂冈之花
湖上湖
随时随地看视频慕课网APP
相关分类