pub struct PcgEngine<Itype, Xtype, StreamMix: Stream<Itype>, MulMix: Multiplier<Itype>, OutMix: OutputMixin<Itype, Xtype>> { /* private fields */ }
Expand description
A generic PCG structure.
This structure allows the building of many types of PCG generators by using various Mixins for both the stream, multiplier, and permutation function.
Implementations
sourceimpl<Itype, Xtype, StreamMix, MulMix, OutMix> PcgEngine<Itype, Xtype, StreamMix, MulMix, OutMix>where
Itype: Zero,
StreamMix: Stream<Itype>,
MulMix: Multiplier<Itype>,
OutMix: OutputMixin<Itype, Xtype>,
PcgEngine<Itype, Xtype, StreamMix, MulMix, OutMix>: SeedableRng,
impl<Itype, Xtype, StreamMix, MulMix, OutMix> PcgEngine<Itype, Xtype, StreamMix, MulMix, OutMix>where
Itype: Zero,
StreamMix: Stream<Itype>,
MulMix: Multiplier<Itype>,
OutMix: OutputMixin<Itype, Xtype>,
PcgEngine<Itype, Xtype, StreamMix, MulMix, OutMix>: SeedableRng,
sourcepub fn new_unseeded() -> Self
pub fn new_unseeded() -> Self
Creates a new PCG without specifying a seed.
WARNING: Every PCG created with this method will produce the same
output. In most cases a seeded PCG will be more useful, please check
the references for rand::SeedableRng
and rand::FromEntropy
for
methods to seed a PCG.
Trait Implementations
sourceimpl<Itype, StreamMix, MulMix, OutMix> RngCore for PcgEngine<Itype, u32, StreamMix, MulMix, OutMix>where
Itype: PcgOps + Clone,
StreamMix: Stream<Itype>,
MulMix: Multiplier<Itype>,
OutMix: OutputMixin<Itype, u32>,
impl<Itype, StreamMix, MulMix, OutMix> RngCore for PcgEngine<Itype, u32, StreamMix, MulMix, OutMix>where
Itype: PcgOps + Clone,
StreamMix: Stream<Itype>,
MulMix: Multiplier<Itype>,
OutMix: OutputMixin<Itype, u32>,
sourcefn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest
with random data. Read moresourceimpl<Itype, StreamMix, MulMix, OutMix> RngCore for PcgEngine<Itype, u64, StreamMix, MulMix, OutMix>where
Itype: PcgOps + Clone,
StreamMix: Stream<Itype>,
MulMix: Multiplier<Itype>,
OutMix: OutputMixin<Itype, u64>,
impl<Itype, StreamMix, MulMix, OutMix> RngCore for PcgEngine<Itype, u64, StreamMix, MulMix, OutMix>where
Itype: PcgOps + Clone,
StreamMix: Stream<Itype>,
MulMix: Multiplier<Itype>,
OutMix: OutputMixin<Itype, u64>,
sourcefn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest
with random data. Read moresourceimpl<Itype, Xtype, StreamMix, MulMix, OutMix> SeedableRng for PcgEngine<Itype, Xtype, StreamMix, MulMix, OutMix>where
Itype: Sized + ReadByteOrder + Zero + One,
StreamMix: Stream<Itype>,
MulMix: Multiplier<Itype>,
OutMix: OutputMixin<Itype, Xtype>,
PcgSeeder<Itype>: Default,
impl<Itype, Xtype, StreamMix, MulMix, OutMix> SeedableRng for PcgEngine<Itype, Xtype, StreamMix, MulMix, OutMix>where
Itype: Sized + ReadByteOrder + Zero + One,
StreamMix: Stream<Itype>,
MulMix: Multiplier<Itype>,
OutMix: OutputMixin<Itype, Xtype>,
PcgSeeder<Itype>: Default,
Auto Trait Implementations
impl<Itype, Xtype, StreamMix, MulMix, OutMix> RefUnwindSafe for PcgEngine<Itype, Xtype, StreamMix, MulMix, OutMix>where
Itype: RefUnwindSafe,
MulMix: RefUnwindSafe,
OutMix: RefUnwindSafe,
StreamMix: RefUnwindSafe,
Xtype: RefUnwindSafe,
impl<Itype, Xtype, StreamMix, MulMix, OutMix> Send for PcgEngine<Itype, Xtype, StreamMix, MulMix, OutMix>where
Itype: Send,
MulMix: Send,
OutMix: Send,
StreamMix: Send,
Xtype: Send,
impl<Itype, Xtype, StreamMix, MulMix, OutMix> Sync for PcgEngine<Itype, Xtype, StreamMix, MulMix, OutMix>where
Itype: Sync,
MulMix: Sync,
OutMix: Sync,
StreamMix: Sync,
Xtype: Sync,
impl<Itype, Xtype, StreamMix, MulMix, OutMix> Unpin for PcgEngine<Itype, Xtype, StreamMix, MulMix, OutMix>where
Itype: Unpin,
MulMix: Unpin,
OutMix: Unpin,
StreamMix: Unpin,
Xtype: Unpin,
impl<Itype, Xtype, StreamMix, MulMix, OutMix> UnwindSafe for PcgEngine<Itype, Xtype, StreamMix, MulMix, OutMix>where
Itype: UnwindSafe,
MulMix: UnwindSafe,
OutMix: UnwindSafe,
StreamMix: UnwindSafe,
Xtype: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<R> FromEntropy for Rwhere
R: SeedableRng,
impl<R> FromEntropy for Rwhere
R: SeedableRng,
sourcefn from_entropy() -> R
fn from_entropy() -> R
Creates a new instance, automatically seeded with fresh entropy. Read more
sourceimpl<R> Rng for Rwhere
R: RngCore + ?Sized,
impl<R> Rng for Rwhere
R: RngCore + ?Sized,
sourcefn gen<T>(&mut self) -> Twhere
Standard: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
Standard: Distribution<T>,
sourcefn gen_range<T, B1, B2>(&mut self, low: B1, high: B2) -> Twhere
T: SampleUniform,
B1: SampleBorrow<T>,
B2: SampleBorrow<T>,
fn gen_range<T, B1, B2>(&mut self, low: B1, high: B2) -> Twhere
T: SampleUniform,
B1: SampleBorrow<T>,
B2: SampleBorrow<T>,
Generate a random value in the range [
low
, high
), i.e. inclusive of
low
and exclusive of high
. Read moresourcefn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
sourcefn sample_iter<T, D, 'a>(&'a mut self, distr: &'a D) -> DistIter<'a, D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D, 'a>(&'a mut self, distr: &'a D) -> DistIter<'a, D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
sourcefn fill<T>(&mut self, dest: &mut T)where
T: AsByteSliceMut + ?Sized,
fn fill<T>(&mut self, dest: &mut T)where
T: AsByteSliceMut + ?Sized,
Fill
dest
entirely with random bytes (uniform value distribution),
where dest
is any type supporting AsByteSliceMut
, namely slices
and arrays over primitive integer types (i8
, i16
, u32
, etc.). Read moresourcefn try_fill<T>(&mut self, dest: &mut T) -> Result<(), Error>where
T: AsByteSliceMut + ?Sized,
fn try_fill<T>(&mut self, dest: &mut T) -> Result<(), Error>where
T: AsByteSliceMut + ?Sized,
Fill
dest
entirely with random bytes (uniform value distribution),
where dest
is any type supporting AsByteSliceMut
, namely slices
and arrays over primitive integer types (i8
, i16
, u32
, etc.). Read moresourcefn gen_bool(&mut self, p: f64) -> bool
fn gen_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p
of being true. Read moresourcefn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator
of being
true. I.e. gen_ratio(2, 3)
has chance of 2 in 3, or about 67%, of
returning true. If numerator == denominator
, then the returned value
is guaranteed to be true
. If numerator == 0
, then the returned
value is guaranteed to be false
. Read moresourcefn choose<T, 'a>(&mut self, values: &'a [T]) -> Option<&'a T>
fn choose<T, 'a>(&mut self, values: &'a [T]) -> Option<&'a T>
👎Deprecated since 0.6.0: use SliceRandom::choose instead
Return a random element from
values
. Read more