pub struct Philox { /* private fields */ }Expand description
Philox 4x32-10 counter-based pseudo-random number generator.
This generator natively supports stream IDs, making it ideal for
parallel generation. Each (seed, stream_id) pair produces an
independent, non-overlapping output sequence.
§Example
use ferray_random::bitgen::Philox;
use ferray_random::bitgen::BitGenerator;
let mut rng = Philox::seed_from_u64(42);
let val = rng.next_u64();Trait Implementations§
Source§impl BitGenerator for Philox
impl BitGenerator for Philox
Source§fn seed_from_u64(seed: u64) -> Self
fn seed_from_u64(seed: u64) -> Self
Create a new generator seeded from a single
u64.Source§fn jump(&mut self) -> Option<()>
fn jump(&mut self) -> Option<()>
Advance the generator state by a large step (2^128 for Xoshiro256**). Read more
Source§fn stream(seed: u64, stream_id: u64) -> Option<Self>
fn stream(seed: u64, stream_id: u64) -> Option<Self>
Create a new generator from a seed and a stream ID. Read more
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill a byte slice with random bytes.
Source§fn next_u64_bounded(&mut self, bound: u64) -> u64
fn next_u64_bounded(&mut self, bound: u64) -> u64
Generate a
u64 in the range [0, bound) using rejection sampling.Auto Trait Implementations§
impl Freeze for Philox
impl RefUnwindSafe for Philox
impl Send for Philox
impl Sync for Philox
impl Unpin for Philox
impl UnsafeUnpin for Philox
impl UnwindSafe for Philox
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more