(value: u64, probability: f64)
| 186 | pub(crate) struct DeterminismLog(Vec<u8>); |
| 187 | |
| 188 | fn probability_sample(value: u64, probability: f64) -> bool { |
| 189 | if probability <= 0.0 { |
| 190 | return false; |
| 191 | } |
| 192 | if probability >= 1.0 { |
| 193 | return true; |
| 194 | } |
| 195 | |
| 196 | let unit = (value >> 11) as f64 * (1.0 / ((1u64 << 53) as f64)); |
| 197 | unit < probability |
| 198 | } |
| 199 | |
| 200 | fn checksum(value: u64) -> u8 { |
| 201 | value.to_ne_bytes().into_iter().fold(0, |acc, byte| acc ^ byte) |
no outgoing calls
no test coverage detected
searching dependent graphs…