MCPcopy Create free account
hub / github.com/docknetwork/crypto / n_rand

Function n_rand

utils/src/misc.rs:65–73  ·  view source on GitHub ↗

Generates an iterator of randoms producing `count` elements using the supplied `rng`.

(
    rng: &'a mut R,
    count: N,
)

Source from the content-addressed store, hash-verified

63
64/// Generates an iterator of randoms producing `count` elements using the supplied `rng`.
65pub 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
69where
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.
76pub fn le_bytes_iter(n: u32) -> impl_indexed_iter!(<Item = [u8; 4]>) {

Callers 15

check_when_powers_of_2Function · 0.85
checkFunction · 0.85
checkFunction · 0.85
test_setupFunction · 0.85
randMethod · 0.85
basic_keygenFunction · 0.85
newMethod · 0.85
basic_workflowFunction · 0.85

Calls 2

randFunction · 0.85
mapMethod · 0.80

Tested by 12

check_when_powers_of_2Function · 0.68
test_setupFunction · 0.68
basic_keygenFunction · 0.68
basic_workflowFunction · 0.68
membership_checkFunction · 0.68
membership_checkFunction · 0.68
membership_checkFunction · 0.68
membership_batch_checkFunction · 0.68