algorithms
algorithms copied to clipboard
Data Generator
数据生成器:./generator/index.js
提供了 7 个函数:
-
getRandomNumber
,生成一个随机数 -
getRandomString
,生成一个随机字符串 -
getRandomNumbers
,生成一个随机数组 -
getDescRandomNumbers
,同上,倒序 -
getEscRandomNumbers
,同上,顺序 -
getRandomStrings
,生成一串随机字符串 -
noRepeat
,字符串/数组去重
传参也具备鲁棒性,比如 getRandomNumbers
:
-
getRandomNumbers();
-
getRandomNumbers(amount);
-
getRandomNumbers(min, max);
-
getRandomNumbers(amount, min, max);
默认长度为 20,随机数区间为 [0, 1E5]
,随机字符串区间为 a-zA-Z0-9_
。
后续会根据需要补充更多随机函数。