📅  最后修改于: 2022-03-11 15:03:53.089000             🧑  作者: Mango
/**
* Get Auto Generated Random Password
*
* @param int length, eg: Default Length = 10
*
* @return string Auto generated random password
*/
const getAutoGeneratedPassword = (length = 10) => {
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
genPass = "";
for (let i = 0, n = charset.length; i < length; ++i) {
genPass += charset.charAt(Math.floor(Math.random() * n));
}
return genPass;
}