Trait EntropySource

Source
pub trait EntropySource {
    // Required method
    fn fill_bytes(&self, buffer: &mut [u8]);
}
Expand description

A trait representing a source for generating entropy/randomness.

Required Methods§

Source

fn fill_bytes(&self, buffer: &mut [u8])

Fills a buffer with random bytes.

This method must generate the specified number of random bytes and write them into the given buffer. It is expected that this method will be cryptographically secure and suitable for use cases requiring strong randomness, such as generating nonces or secret keys.

Implementors§