📌  相关文章
📜  javascript 随机字母数字字符串 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:45.746000             🧑  作者: Mango

代码示例3
// 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;
}