EN: Hit probability (1% ~ 100%).
ZH: 百分位概率。
Usage:
const ret = isHit(0.5); // 0.01 ~ 1 true/falseconsole.log(ret); Copy
const ret = isHit(0.5); // 0.01 ~ 1 true/falseconsole.log(ret);
Output:
true Copy
true
Example: Test the precision.
// Testlet trueCount = 0;let falseCount = 0;new Array(1000000).fill(0).forEach(() => { if (isHit(0.5)) { trueCount++; } else { falseCount++; }});console.log(trueCount, falseCount); // 499994 500006 Copy
// Testlet trueCount = 0;let falseCount = 0;new Array(1000000).fill(0).forEach(() => { if (isHit(0.5)) { trueCount++; } else { falseCount++; }});console.log(trueCount, falseCount); // 499994 500006
0.1 ~ 1 => 1% ~ 100%
true 命中
EN: Hit probability (1% ~ 100%).
ZH: 百分位概率。
Usage:
Output:
Example: Test the precision.