(prob: f32)
| 45 | } |
| 46 | |
| 47 | pub 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 | |
| 57 | pub fn rand_comb_len() -> usize { |
| 58 | let lens: Vec<usize> = (crate::config::DEFAULT_COMB_LEN..10).collect(); |
no test coverage detected