pub struct LibcRng {}Expand description
Non-deterministic random number generator using MEGA65 Libc
Implements the rand::RngCore
trait and can thus be used with Rusts rand crate.
§Examples
use mos_hardware::mega65::random;
use rand::seq::SliceRandom;
let mut rng = LibcRng::default();
let value = [11, 23].choose(&mut rng).unwrap(); // 11 or 23Implementations§
Trait Implementations§
Source§impl RngCore for LibcRng
impl RngCore for LibcRng
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest with random data. Read moreAuto Trait Implementations§
impl Freeze for LibcRng
impl RefUnwindSafe for LibcRng
impl Send for LibcRng
impl Sync for LibcRng
impl Unpin for LibcRng
impl UnwindSafe for LibcRng
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
Mutably borrows from an owned value. Read more