javascript 生成随机字符串函数

function generateRandomAlphaNum(len) {

var rdmString = “”;

for (; rdmString.length < len; rdmString += Math.random().toString(36).substr(2));

return rdmString.substr(0, len);

}