Simplify maybe

Fix whitespace
This commit is contained in:
infogulch
2023-09-20 16:38:58 -05:00
parent 54a0313d72
commit eecfeb2d03
3 changed files with 10 additions and 26 deletions

View File

@@ -4215,23 +4215,7 @@ impl Machine {
#[inline(always)] #[inline(always)]
pub(crate) fn maybe(&mut self) { pub(crate) fn maybe(&mut self) {
fn generate_random_bits(rng: &mut rand::rngs::StdRng, num_bits: usize) -> u64 { self.machine_st.fail = self.rng.gen();
let mut random_bits: u64 = 0;
for _ in 0..num_bits {
random_bits <<= 1;
if rng.gen_bool(0.5) {
random_bits |= 1;
}
}
random_bits
}
let result = { generate_random_bits(&mut self.rng, 1) == 0 };
self.machine_st.fail = result;
} }
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]