AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
>[info] 获取不重复的id ~~~ /** * @description 获取不重复的id * @param length { Number } id的长度 * @return { String } id */ export const getNonDuplicateID = (length = 8) => { let idStr = Date.now().toString(36) idStr += Math.random().toString(36).substring(3, length) return idStr } ~~~ ~~~ /** * 生成随机字符串 * @param length 长度 * @param radix 基数 * @returns {string} */ export function uuid(length = 32, radix) { const num = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; let result = ''; for (let i = 0; i < length; i++) { result += num.charAt(Math.floor(Math.random() * (radix || num.length))); } return result; } ~~~ ~~~ /** * 生成m到n的随机数 * @param m 最小值, 包含 * @param n 最大值, 不包含 * @returns {number} */ export function random(m, n) { return Math.floor(Math.random() * (m - n) + n); } ~~~