1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#![feature(test)] #![cfg(std)] use test::Bencher; use rand_jitter::rand_core::RngCore; #[bench] fn bench_add_two(b: &mut Bencher) { let mut rng = rand_jitter::JitterRng::new().unwrap(); let mut buf = [0u8; 1024]; b.iter(|| { rng.fill_bytes(&mut buf[..]); test::black_box(&buf); }); b.bytes = buf.len() as u64; }