Trait schnorr_fun::nonce::NonceRng[][src]

pub trait NonceRng {
    fn fill_bytes(&self, bytes: &mut [u8]);
}
Expand description

A helper trait over RNGs that handle internal mutablility.

RngCore requires self to be mutable which is annoying in our context. This trait requires the rng be able to create randomness without being mutable. The most strightforward way of doing this is to use transient rngs instances like ThreadRng that have a Default implementation. For this reason, this trait is implemented for PhantomData<ThreadRng> (any Rng that implements Default). If you want to BYO rng you have to implement this trait yourself and handle mutability internally.

Required methods

Fill bytes with random data.

Implementors