MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / generateMix

Function generateMix

tech-study.js:2334–2351  ·  view source on GitHub ↗

* @description 随机混合字符 * @param length * @returns

(length = 6)

Source from the content-addressed store, hash-verified

2332 * @returns
2333 */
2334function generateMix(length = 6) {
2335 // 随机字符串
2336 const randomText = [];
2337 // 生成器
2338 const typeGenerator = [
2339 generateNumAsChar,
2340 generateUpperAsChar,
2341 generateLowerAsChar,
2342 ];
2343 if (length) {
2344 for (let i = 0; i < length; i++) {
2345 // 随机位置
2346 const randomIndex = ~~(Math.random() * typeGenerator.length);
2347 randomText.push(typeGenerator[randomIndex]());
2348 }
2349 }
2350 return randomText.join('');
2351}
2352/**
2353 * @description 格式化日期时间数字
2354 * @param num

Callers 1

openFrameFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected