MCPcopy Create free account
hub / github.com/esengine/esengine / nextBool

Method nextBool

packages/procgen/src/random/SeededRandom.ts:99–101  ·  view source on GitHub ↗

* @zh 生成布尔值 * @en Generate boolean * * @param probability - @zh 为 true 的概率 [0, 1] @en Probability of true [0, 1]

(probability: number = 0.5)

Source from the content-addressed store, hash-verified

97 * @param probability - @zh 为 true 的概率 [0, 1] @en Probability of true [0, 1]
98 */
99 nextBool(probability: number = 0.5): boolean {
100 return this.next() < probability;
101 }
102
103 /**
104 * @zh 生成正态分布随机数 (Box-Muller 变换)

Callers

nothing calls this directly

Calls 1

nextMethod · 0.95

Tested by

no test coverage detected