Generates an iterator of randoms producing `count` elements using the supplied `rng`.
(
rng: &'a mut R,
count: N,
)
| 63 | |
| 64 | /// Generates an iterator of randoms producing `count` elements using the supplied `rng`. |
| 65 | pub fn n_rand<'a, T: UniformRand, R: RngCore, N: From<u8> + 'a>( |
| 66 | rng: &'a mut R, |
| 67 | count: N, |
| 68 | ) -> impl DoubleEndedExactSizeIterator<Item = T> + 'a |
| 69 | where |
| 70 | Range<N>: DoubleEndedExactSizeIterator, |
| 71 | { |
| 72 | (0.into()..count).map(move |_| rand(rng)) |
| 73 | } |
| 74 | |
| 75 | /// Produces an iterator emitting `n` items `u32::to_le_bytes` of the counter starting from zero. |
| 76 | pub fn le_bytes_iter(n: u32) -> impl_indexed_iter!(<Item = [u8; 4]>) { |