const randomRangeId = (num: any) => {
let returnStr = "",
charStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (let i = 0; i < num; i++) {
let index = Math.round(Math.random() * (charStr.length - 1));
returnStr += charStr.substring(index, index + 1);
}
return returnStr
}
function randomLenNum(len, date) {
let random = ''
random = Math.ceil(Math.random() * 100000000000000)
.toString()
.substring(0, len || 4)
if (date) random = random + Date.now()
return random
}
//生成随机数
function rand(m: any, n: any) {
return Math.ceil(Math.random() * (n - m + 1)) + m - 1;
}
欢迎补充,一起进步。