pub struct SipRand {
key: SipState,
counter: u64,
}
Expand description
HashX-style random number generator built on SipHash1,3
This is an implementation of RngCore
using SipHash1,3 as
the 64-bit PRNG layer needed by HashX’s program generator.
Fields§
§key: SipState
SipHash state vector used as input to SipHash1,3 in counter mode
counter: u64
Next 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§
Auto Trait Implementations§
impl Freeze for SipRand
impl RefUnwindSafe for SipRand
impl Send for SipRand
impl Sync for SipRand
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
The type returned in the event of a RNG error.
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
Return the next random
u32
.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
Return the next random
u64
.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
Fill
dest
entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
Wrap RNG with the
UnwrapMut
wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
Convert an
RngCore
to a RngReadAdapter
.