function nRandom(n) {
let max = 1
for (let i = 0; i < n; i++) {
max *= 10
}
let str = '' + parseInt(Math.random() * max)
let count = n - str.length
for (let j = 0; j < count; j++) {
str += '0'
}
return str
}
function nRandom(n) {
let max = 1
for (let i = 0; i < n; i++) {
max *= 10
}
let str = '' + parseInt(Math.random() * max)
let count = n - str.length
for (let j = 0; j < count; j++) {
str += '0'
}
return str
}
本文标题:返回长度为n的随机数字符串的函数
本文链接:https://www.haomeiwen.com/subject/atfucctx.html
网友评论