Refactor TypeScript interfaces and types for consistency and readability
Gitea Auto Deploy / Deploy-Container (push) Successful in 49s
Gitea Auto Deploy / Deploy-Container (push) Successful in 49s
- Reformatted multiple TypeScript interfaces across various files to ensure consistent spacing and indentation. - Updated `changelog.ts`, `enka.ts`, `extraData.ts`, `gloval.d.ts`, `index.ts`, `lightconeDetail.ts`, `metaData.ts`, `mics.ts`, `modelConfig.ts`, `monsterDetail.ts`, `peakDetail.ts`, `pfDetail.ts`, `psConnect.ts`, `relicDetail.ts`, `showcase.ts`, `srtools.ts`, and `zod/index.ts` for improved code clarity. - Ensured all interfaces are properly formatted with consistent line breaks and spacing. - Made minor adjustments to the `tsconfig.json` file for formatting consistency.
This commit is contained in:
+23
-23
@@ -8,27 +8,27 @@ export function randomPartition(sum: number, parts: number): number[] {
|
||||
|
||||
const raw = Array.from({ length: parts }, () => Math.random());
|
||||
const total = raw.reduce((a, b) => a + b, 0);
|
||||
const result = raw.map(r => Math.floor((r / total) * (sum - parts)) + 1);
|
||||
let diff = sum - result.reduce((a, b) => a + b, 0);
|
||||
while (diff !== 0) {
|
||||
for (let i = 0; i < result.length && diff !== 0; i++) {
|
||||
if (diff > 0) {
|
||||
result[i]++;
|
||||
diff--;
|
||||
} else if (result[i] > 1) {
|
||||
result[i]--;
|
||||
diff++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export function randomStep(x: number): number {
|
||||
let total = 0;
|
||||
for (let i = 0; i < x; i++) {
|
||||
total += Math.floor(Math.random() * 3);
|
||||
}
|
||||
return total;
|
||||
const result = raw.map(r => Math.floor((r / total) * (sum - parts)) + 1);
|
||||
let diff = sum - result.reduce((a, b) => a + b, 0);
|
||||
while (diff !== 0) {
|
||||
for (let i = 0; i < result.length && diff !== 0; i++) {
|
||||
if (diff > 0) {
|
||||
result[i]++;
|
||||
diff--;
|
||||
} else if (result[i] > 1) {
|
||||
result[i]--;
|
||||
diff++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export function randomStep(x: number): number {
|
||||
let total = 0;
|
||||
for (let i = 0; i < x; i++) {
|
||||
total += Math.floor(Math.random() * 3);
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user