Struct quickcheck::StdGen
source · pub struct StdGen<R> { /* private fields */ }
Expand description
StdGen is the default implementation of Gen
.
Values of type StdGen
can be created with the gen
function in this
crate.
Implementations
sourceimpl<R: RngCore> StdGen<R>
impl<R: RngCore> StdGen<R>
sourcepub fn new(rng: R, size: usize) -> StdGen<R>
pub fn new(rng: R, size: usize) -> StdGen<R>
Returns a StdGen
with the given configuration using any random number
generator.
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
Auto Trait Implementations
impl<R> RefUnwindSafe for StdGen<R>where
R: RefUnwindSafe,
impl<R> Send for StdGen<R>where
R: Send,
impl<R> Sync for StdGen<R>where
R: Sync,
impl<R> Unpin for StdGen<R>where
R: Unpin,
impl<R> UnwindSafe for StdGen<R>where
R: 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> 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>(&mut self, low: T, high: T) -> Twhere
T: PartialOrd<T> + SampleUniform,
fn gen_range<T>(&mut self, low: T, high: T) -> Twhere
T: PartialOrd<T> + SampleUniform,
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 choose<T, 'a>(&mut self, values: &'a [T]) -> Option<&'a T>
fn choose<T, 'a>(&mut self, values: &'a [T]) -> Option<&'a T>
Return a random element from
values
. Read moresourcefn choose_mut<T, 'a>(&mut self, values: &'a mut [T]) -> Option<&'a mut T>
fn choose_mut<T, 'a>(&mut self, values: &'a mut [T]) -> Option<&'a mut T>
Return a mutable pointer to a random element from
values
. Read moresourcefn gen_iter<T>(&mut self) -> Generator<T, &mut Self>where
Standard: Distribution<T>,
fn gen_iter<T>(&mut self) -> Generator<T, &mut Self>where
Standard: Distribution<T>,
👎Deprecated since 0.5.0: use Rng::sample_iter(&Standard) instead
Return an iterator that will yield an infinite number of randomly
generated items. Read more
sourcefn gen_weighted_bool(&mut self, n: u32) -> bool
fn gen_weighted_bool(&mut self, n: u32) -> bool
👎Deprecated since 0.5.0: use gen_bool instead
Return a bool with a 1 in n chance of true Read more
sourcefn gen_ascii_chars(&mut self) -> AsciiGenerator<&mut Self>
fn gen_ascii_chars(&mut self) -> AsciiGenerator<&mut Self>
👎Deprecated since 0.5.0: use sample_iter(&Alphanumeric) instead
Return an iterator of random characters from the set A-Z,a-z,0-9. Read more