fix(business): 修复 skewedRandom 函数中的数学计算错误

- 更新 skewedRandom 函数中的公式,确保正确计算随机值,提升函数的准确性和可靠性。
This commit is contained in:
雨霖铃
2026-06-19 20:27:30 +08:00
parent 228cadf526
commit 9d6213e75e
+1 -1
View File
@@ -434,7 +434,7 @@ function skewedRandom(min: number, max: number): number {
v = 0; v = 0;
while (u === 0) u = Math.random(); while (u === 0) u = Math.random();
while (v === 0) v = Math.random(); while (v === 0) v = Math.random();
const x = Math.pow(u, 1 / alpha) / Math.pow(u, 1 / alpha) + Math.pow(v, 1 / beta); const x = Math.pow(u, 1 / alpha) / (Math.pow(u, 1 / alpha) + Math.pow(v, 1 / beta));
return min + x * (max - min); return min + x * (max - min);
} }