Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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]
268
pub 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_chance
Method · 0.85
random_api_typecheck_and_forward
Function · 0.85
Calls
2
rand01
Function · 0.85
clamp
Method · 0.45
Tested by
1
random_api_typecheck_and_forward
Function · 0.68