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