pub struct Random(());
riot_module_random
only.Expand description
The global random number generator available in RIOT
Actual functionality is available through its implementation of rand_core_06::RngCore. It
implements rand_core_06::CryptoRng if the RIOT module prng_shaxprng
is present. (If more
CSPRNGs are implemented in RIOT, the list around this implementation needs to be extended).
Note that this is copy (unlike what RngCore recommends) – because the state is not in here but global (as is their own OsRng).
Tuple Fields§
§0: ()
Implementations§
Source§impl Random
impl Random
Sourcepub fn new() -> Self
Available on riot_module_auto_init_random
only.
pub fn new() -> Self
riot_module_auto_init_random
only.Access the system random number generator
Sourcepub unsafe fn new_with_seed(seed: u32) -> Self
pub unsafe fn new_with_seed(seed: u32) -> Self
Seed and start the random number generator
While technically not unsound, this is marked unsafe as it may overwrite existing good RNG state.
This is not going through the the rand_core_06::SeedableRng trait because that would require per-RNG seedability.
Trait Implementations§
Source§impl RngCore for Random
impl RngCore for Random
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
dest
with random data. Read moreimpl Copy for Random
impl CryptoRng for Random
riot_module_prng_shaxprng
only.Auto Trait Implementations§
impl Freeze for Random
impl RefUnwindSafe for Random
impl Send for Random
impl Sync for Random
impl Unpin for Random
impl UnwindSafe for Random
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CryptoRngCore for T
impl<T> CryptoRngCore for T
Source§fn as_rngcore(&mut self) -> &mut dyn RngCore
fn as_rngcore(&mut self) -> &mut dyn RngCore
RngCore
trait object.Source§impl<T> IntoSwitch for T
impl<T> IntoSwitch for T
Source§fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
Source§fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 0 bytes