pub struct SipRand {
key: SipState,
counter: u64,
}Expand description
HashX-style random number generator built on SipHash1,3
This is an implementation of Rng using SipHash1,3 as
the 64-bit PRNG layer needed by HashX’s program generator.
Fields§
§key: SipStateSipHash state vector used as input to SipHash1,3 in counter mode
counter: u64Next unused counter value
Implementations§
Source§impl SipRand
impl SipRand
Sourcepub fn new(key: SipState) -> Self
pub fn new(key: SipState) -> Self
Build a new SipHash random number generator.
The internal SipHash1,3 generator is initialized to a supplied internal state, and the counter is reset to zero.
Sourcepub fn new_with_counter(key: SipState, counter: u64) -> Self
pub fn new_with_counter(key: SipState, counter: u64) -> Self
Build a new SipRand with a specific initial counter value.
Trait Implementations§
Source§impl TryRng for SipRand
impl TryRng for SipRand
Source§fn try_next_u64(&mut self) -> Result<u64, Infallible>
fn try_next_u64(&mut self) -> Result<u64, Infallible>
Generate a full 64-bit random result using SipHash1,3.
Source§fn try_next_u32(&mut self) -> Result<u32, Infallible>
fn try_next_u32(&mut self) -> Result<u32, Infallible>
Return a 32-bit value by discarding the upper half of a 64-bit result.
Source§fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Infallible>
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Infallible>
Fill dest with random data.
Source§type Error = Infallible
type Error = Infallible
The type returned in the event of a RNG error. Read more
Auto Trait Implementations§
impl Freeze for SipRand
impl RefUnwindSafe for SipRand
impl Send for SipRand
impl Sync for SipRand
impl Unpin for SipRand
impl UnsafeUnpin for SipRand
impl UnwindSafe for SipRand
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