拆分数据处理分类,新增编码加密、数学计算分类

This commit is contained in:
fofolee
2025-01-08 16:13:50 +08:00
parent 430466c38c
commit 8003497e71
18 changed files with 271 additions and 239 deletions

View File

@@ -0,0 +1,5 @@
const random = require("./random");
module.exports = {
random,
};

View File

@@ -0,0 +1,23 @@
const randomInt = (start, end) => {
return Math.round(Math.random() * (end - start) + start);
};
const random = (isInt = false, start, end) => {
if (!start && !end) {
return isInt ? randomInt(0, 1000000) : Math.random();
}
if (!end) {
end = Math.abs(randomInt(0, 1000000) - start);
}
if (!start) {
start = 0;
}
// 有start和end返回区间随机数
const random = Math.random() * (end - start) + start;
return isInt ? Math.round(random) : random;
};
module.exports = random;