📅  最后修改于: 2022-03-11 15:01:45.746000             🧑  作者: Mango
// n is an integer
function randomString (n) {
// create array of length n filled with null
let tmpArr = Array.apply(null, Array(n));
// for each index generate a random positive integer
// less than 36 and convert it to a base 36 digit
tmpArr.map((v, i) =>
Math.floor(Math.random() * 36).toString(36)
).join('');
return tmpArr;
}