Skip to content

Commit

Permalink
Use fill_bytes_via_u32 in JitterRng
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Jan 22, 2018
1 parent 7a07c36 commit 7f61e2f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/jitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,13 @@ impl Rng for JitterRng {
}

fn fill_bytes(&mut self, dest: &mut [u8]) {
impls::fill_bytes_via_u64(self, dest)
// Fill using `next_u32`. This is faster for filling small slices (four
// bytes or less), while the overhead is negligible (in benchmarks even
// slightly faster instead of slower).
//
// This is done especially for wrappers that implement `next_u32`
// themselves via `fill_bytes`.
impls::fill_bytes_via_u32(self, dest)
}
}

Expand Down

0 comments on commit 7f61e2f

Please sign in to comment.