2018-08-02

生成随机字符串

function randomStr(len) {
    var str = "";
    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    for( var i=0; i < len; i++ )
        str += possible.charAt(Math.floor(Math.random() * possible.length));

    return str;
}

你可能感兴趣的:(2018-08-02)