MCPcopy Create free account
hub / github.com/PerroEngine/Perro / chance

Function chance

perro_source/api_modules/perro_modules/src/random.rs:267–270  ·  view source on GitHub ↗
(probability: f32, seed: u32)

Source from the content-addressed store, hash-verified

265}
266
267#[inline]
268pub fn chance(probability: f32, seed: u32) -> bool {
269 let p = probability.clamp(0.0, 1.0);
270 rand01(seed) < p
271}
272
273#[inline]

Callers 2

next_chanceMethod · 0.85

Calls 2

rand01Function · 0.85
clampMethod · 0.45

Tested by 1