A type that can be randomly generated using an
This crate implements
Rand for various primitive types. Assuming the
Rng is well-behaved, these implementations generate values with
the following ranges and distributions:
- Integers (
usize, etc.): Uniformly distributed over all values of the type.
char: Uniformly distributed over all Unicode scalar values, i.e. all code points in the range
0...0x10_FFFF, except for the range
0xD800...0xDFFF(the surrogate code points). This includes unassigned/reserved code points.
true, each with probability 0.5.
- Floating point types (
f64): Uniformly distributed in the half-open range
[0, 1). (The
StandardNormalwrapper types produce floating point numbers with alternative ranges or distributions.)
The following aggregate types also implement
Rand as long as their
component types implement it:
- Tuples and arrays: Each element of the tuple or array is generated
independently, using its own
Nonewith probability 0.5; otherwise generates a random
Generates a random instance of this type using the specified source of randomness.