唯一数
function genUuid(length) {
const random = Date.now().toString(36);
if (random.length > length) {
return random.substr().substr(random.length - length, length);
} else if (random.length < length) {
return Array(length - random.length).fill('').map(() => Math.ceil(Math.random() * 35).toString(36)).join('') + random;
}
return random;
}
本文来自博客园,作者:云霄紫潭,转载请注明原文链接:https://www.cnblogs.com/0520euv/p/15812167.html