mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 21:27:47 +00:00
typo: 代码注释
This commit is contained in:
parent
51b3908afd
commit
4c90ca5354
12 changed files with 457 additions and 139 deletions
26
utils/data.js
Normal file
26
utils/data.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* 生成随机字符串
|
||||
* @param {number} length 长度
|
||||
* @returns {string}
|
||||
*/
|
||||
export const randomString = length => {
|
||||
let randomStr = '';
|
||||
for (let i = 0; i < length; i++) {
|
||||
randomStr += _.sample('abcdefghijklmnopqrstuvwxyz0123456789');
|
||||
}
|
||||
return randomStr;
|
||||
};
|
||||
|
||||
/**
|
||||
* 生成随机种子
|
||||
* @param {number} length 长度
|
||||
* @returns {string}
|
||||
*/
|
||||
export const generateSeed = (length = 16) => {
|
||||
const characters = '0123456789abcdef';
|
||||
let result = '';
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += characters[Math.floor(Math.random() * characters.length)];
|
||||
}
|
||||
return result;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue