Skip to main content

PlatformRandom

Trait PlatformRandom 

Source
pub trait PlatformRandom {
    // Required methods
    fn random_u8() -> u8;
    fn random_u16() -> u16;
    fn random_u32() -> u32;
    fn random_u64() -> u64;
    fn random_fill(buf: *mut c_void, len: usize);
}
Expand description

Pseudo-random number generation.

A simple xorshift32 PRNG is sufficient. Seed with hardware entropy (RNG peripheral, ADC noise, wall-clock time) during platform init.

Required Methods§

Source

fn random_u8() -> u8

Source

fn random_u16() -> u16

Source

fn random_u32() -> u32

Source

fn random_u64() -> u64

Source

fn random_fill(buf: *mut c_void, len: usize)

Fill buffer with random bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§