唯一数

  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;
        }
posted @ 2022-01-17 09:21  云霄紫潭  阅读(75)  评论(0编辑  收藏  举报