Struct squares_rnd::Rand
source · pub struct Rand { /* private fields */ }
Expand description
Stateful representation of algorithm.
Increments counter on each generation using the same key.
Implementations§
source§impl Rand
impl Rand
sourcepub const fn with_counter(counter: u64, key: u64) -> Self
pub const fn with_counter(counter: u64, key: u64) -> Self
Creates new instance with provided key and initial value of counter.
sourcepub fn set_counter(&self, counter: u64) -> u64
pub fn set_counter(&self, counter: u64) -> u64
Sets new counter value, returning old one
sourcepub fn next_full_u32(&self) -> RandRes<u32>
pub fn next_full_u32(&self) -> RandRes<u32>
Generates new u32
together with corresponding counter value
sourcepub fn next_u32_up(&self, to: u32) -> u32
pub fn next_u32_up(&self, to: u32) -> u32
Generates new u32
in range 0..to
sourcepub fn next_full_u64(&self) -> RandRes<u64>
pub fn next_full_u64(&self) -> RandRes<u64>
Generates new u64
together with corresponding counter value
sourcepub fn next_u64_up(&self, to: u64) -> u64
pub fn next_u64_up(&self, to: u64) -> u64
Generates new u64
in range 0..to
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Rand
impl Send for Rand
impl Sync for Rand
impl Unpin for Rand
impl UnwindSafe for Rand
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