pub struct PCG32 {
pub state: u64,
pub inc: u64,
}
Expand description
A Permuted Congruential Generator with 32-bit output.
- Period:
2**64
wheninc
is odd, otherwise less
Fields§
§state: u64
The generator’s state.
This changes with each step of the generator. It’s the generator’s “position” within the output stream.
inc: u64
The generator’s increment.
This doesn’t change as the generator advances. Instead it determines which
of the possible output streams the generator will use. Each inc
value
will give a different ordering of all the possible outputs.
Implementations§
source§impl PCG32
impl PCG32
sourcepub const fn new(state: u64, inc: u64) -> Self
pub const fn new(state: u64, inc: u64) -> Self
Creates a new generator by directly using the value given.
sourcepub fn from_getrandom() -> Result<Self, Error>
Available on crate feature getrandom
only.
pub fn from_getrandom() -> Result<Self, Error>
getrandom
only.Create a new generator seeded with data from getrandom.
This method ensures that the inc
of the new generator is odd.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for PCG32
impl Send for PCG32
impl Sync for PCG32
impl Unpin for PCG32
impl UnwindSafe for PCG32
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