build: output files to dir

This commit is contained in:
jialin
2024-06-17 13:03:41 +08:00
parent 2352c316c0
commit 9fa61b9849
20 changed files with 776 additions and 245 deletions
+27
View File
@@ -28,3 +28,30 @@ export const convertFileSize = (sizeInBytes: number) => {
return `${(sizeInBytes / (1024 * 1024 * 1024 * 1024)).toFixed(2)} TB`;
}
};
export const generateRandomArray = (config?: {
min: number;
max: number;
length: number;
offset: number;
}) => {
const { min, max, length, offset } = config || {
min: 10,
max: 80,
length: 10,
offset: 10
};
const data = [];
let prevValue = Math.floor(Math.random() * (max - min + 1)) + min;
for (let i = 0; i < length; i++) {
// 确保波动不太大
let newValue = prevValue + Math.floor(Math.random() * 21) - offset; // 波动范围 [-10, 10]
newValue = Math.max(min, Math.min(max, newValue)); // 保证在 [10, 100] 范围内
data.push(newValue);
prevValue = newValue;
}
return data;
};