Struct quickcheck::StdThreadGen
source · pub struct StdThreadGen(_);
Expand description
StdThreadGen is an RNG in thread-local memory.
This is the default RNG used by quickcheck.
Implementations
sourceimpl StdThreadGen
impl StdThreadGen
sourcepub fn new(size: usize) -> StdThreadGen
pub fn new(size: usize) -> StdThreadGen
Returns a new thread-local RNG.
The size
parameter controls the size of random values generated. For
example, it specifies the maximum length of a randomly generated vector
and also will specify the maximum magnitude of a randomly generated
number.
Trait Implementations
sourceimpl RngCore for StdThreadGen
impl RngCore for StdThreadGen
sourcefn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest
with random data. Read moreAuto Trait Implementations
impl RefUnwindSafe for StdThreadGen
impl !Send for StdThreadGen
impl !Sync for StdThreadGen
impl Unpin for StdThreadGen
impl UnwindSafe for StdThreadGen
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> 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