/**
* 获取某一长度的随机字符串 { len: 16, other: '!#$%()*+,-./:;=?@[]^_`{|}~' }
* @param {number} len 长度,可不传,默认 6 - 16 取值
* @param {string} other 添加字符串,可不传,默认为空
*/
const genUid = (len, other) => {
let def = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
let out = []
!len && (len = parseInt(6 + Math.random() * 10))
other && (def = other + def)
for (let i = 0; i < len; i++) {
out[i] = def.charAt(Math.random() * def.length)
}
}
genUid(10)