MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / prob_coin

Function prob_coin

src/program/rand.rs:47–55  ·  view source on GitHub ↗
(prob: f32)

Source from the content-addressed store, hash-verified

45}
46
47pub fn prob_coin(prob: f32) -> bool {
48 if prob == 0.0_f32 {
49 return false;
50 }
51 assert!(prob < 1.0, "{prob} should < 1.0");
52 assert!(prob > 0.0, "{prob} should > 0.0");
53 let random: f32 = get_global_rng().gen_range(0.0..1.0);
54 random < prob
55}
56
57pub fn rand_comb_len() -> usize {
58 let lens: Vec<usize> = (crate::config::DEFAULT_COMB_LEN..10).collect();

Callers 2

should_deleteMethod · 0.85

Calls 1

get_global_rngFunction · 0.85

Tested by

no test coverage detected