javascriptfunction getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min
}
function getRandomIntArray(minLength, maxLength) {
const length = getRandomInt(minLength, maxLength)
const arr = []
for (let i = 0; i < length; i++) {
arr.push(getRandomInt(1, 100)) // 假设随机整数的范围是 1 到 100
}
return arr
}
本文作者:姚文罡
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!