pub struct CyclicRng { /* private fields */ }Trait Implementations§
Source§impl RngCore for CyclicRng
impl RngCore for CyclicRng
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest with random data. Read moreSource§impl SeedableRng for CyclicRng
impl SeedableRng for CyclicRng
Source§type Seed = CyclicSeed
type Seed = CyclicSeed
Seed type, which is restricted to types mutably-dereferenceable as
u8
arrays (we recommend [u8; N] for some N). Read moreSource§fn seed_from_u64(state: u64) -> Self
fn seed_from_u64(state: u64) -> Self
Create a new PRNG using a
u64 seed. Read moreSource§fn from_rng<R>(rng: R) -> Result<Self, Error>where
R: RngCore,
fn from_rng<R>(rng: R) -> Result<Self, Error>where
R: RngCore,
Create a new PRNG seeded from another
Rng. Read moreSource§fn from_entropy() -> Self
fn from_entropy() -> Self
Source§impl SimRng for CyclicRng
impl SimRng for CyclicRng
Source§fn gen_bool(&mut self, p: f64) -> bool
fn gen_bool(&mut self, p: f64) -> bool
Generate a single bool where true has a probability of
p.Source§fn gen_bools(&mut self, p: f64, n: usize) -> Vec<bool>
fn gen_bools(&mut self, p: f64, n: usize) -> Vec<bool>
Generates a vector of bools, where true has an independent probability of
p.Source§fn choose_weighted<'a, T>(&mut self, choices: &'a Choices<T>) -> &'a T
fn choose_weighted<'a, T>(&mut self, choices: &'a Choices<T>) -> &'a T
Choose between options given a weighted probabilities.
fn from_entropy() -> Self
Auto Trait Implementations§
impl Freeze for CyclicRng
impl RefUnwindSafe for CyclicRng
impl Send for CyclicRng
impl Sync for CyclicRng
impl Unpin for CyclicRng
impl UnwindSafe for CyclicRng
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<R> Rng for R
impl<R> Rng for R
Source§fn gen<T>(&mut self) -> Twhere
Standard: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
Standard: Distribution<T>,
Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn 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
Source§fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
Source§fn 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 moreSource§fn 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 more