pub struct Pcg64 { /* private fields */ }Expand description
PCG64 (PCG-XSL-RR 128/64) pseudo-random number generator.
Uses a 128-bit linear congruential generator with a permutation-based
output function. Period is 2^128. Does not support jump() or stream().
§Example
use ferray_random::bitgen::Pcg64;
use ferray_random::bitgen::BitGenerator;
let mut rng = Pcg64::seed_from_u64(42);
let val = rng.next_u64();Trait Implementations§
Source§impl BitGenerator for Pcg64
impl BitGenerator for Pcg64
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 Pcg64
impl RefUnwindSafe for Pcg64
impl Send for Pcg64
impl Sync for Pcg64
impl Unpin for Pcg64
impl UnsafeUnpin for Pcg64
impl UnwindSafe for Pcg64
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