Skip to content

Commit

Permalink
Implement Rng::fill
Browse files Browse the repository at this point in the history
Fills a byte slice with random data.
  • Loading branch information
cloudhead committed Sep 10, 2022
1 parent f53d813 commit ae75703
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,14 @@ impl Rng {
}
}

/// Fill a byte slice with random data.
#[inline]
pub fn fill(&self, slice: &mut [u8]) {
for item in slice {
*item = self.u8(..);
}
}

rng_integer!(
u8,
u8,
Expand Down

0 comments on commit ae75703

Please sign in to comment.