Trait kernel::hil::rng::Random

source ·
pub trait Random<'a> {
    // Required methods
    fn initialize(&'a self);
    fn reseed(&self, seed: u32);
    fn random(&self) -> u32;
Expand description

Generic interface for a synchronous 32-bit random number generator.

Required Methods§


fn initialize(&'a self)

Initialize/reseed the random number generator from an internal source. This initialization MAY be deterministic (e.g., based on an EUI-64) or MAY be random (e.g., based on an underlying hardware entropy source); an implementation SHOULD make reseeding random.


fn reseed(&self, seed: u32)

Reseed the random number generator with a specific seed. Useful for deterministic tests.


fn random(&self) -> u32

Generate a 32-bit random number.