Struct snarkvm_console_program::Standard
source · pub struct Standard;Expand description
A generic random value distribution, implemented for many primitive types. Usually generates values with a numerically uniform distribution, and with a range appropriate to the type.
Provided implementations
Assuming the provided Rng is well-behaved, these implementations
generate values with the following ranges and distributions:
- Integers (
i32,u32,isize,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 range0...0x10_FFFF, except for the range0xD800...0xDFFF(the surrogate code points). This includes unassigned/reserved code points.bool: Generatesfalseortrue, each with probability 0.5.- Floating point types (
f32andf64): Uniformly distributed in the half-open range[0, 1). See notes below. - Wrapping integers (
Wrapping<T>), besides the type identical to their normal integer variants.
The Standard distribution also supports generation of the following
compound types where all component types are supported:
- Tuples (up to 12 elements): each element is generated sequentially.
- Arrays (up to 32 elements): each element is generated sequentially;
see also
Rng::fillwhich supports arbitrary array length for integer and float types and tends to be faster foru32and smaller types. When usingrustc≥ 1.51, enable themin_const_genfeature to support arrays larger than 32 elements. Note thatRng::fillandStandard’s array support are not equivalent: the former is optimised for integer types (using fewer RNG calls for element types smaller than the RNG word size), while the latter supports any element type supported byStandard. Option<T>first generates abool, and if true generates and returnsSome(value)wherevalue: T, otherwise returningNone.
Custom implementations
The Standard distribution may be implemented for user types as follows:
use rand::Rng;
use rand::distributions::{Distribution, Standard};
struct MyF32 {
x: f32,
}
impl Distribution<MyF32> for Standard {
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> MyF32 {
MyF32 { x: rng.gen() }
}
}Example usage
use rand::prelude::*;
use rand::distributions::Standard;
let val: f32 = StdRng::from_entropy().sample(Standard);
println!("f32 from [0, 1): {}", val);Floating point implementation
The floating point implementations for Standard generate a random value in
the half-open interval [0, 1), i.e. including 0 but not 1.
All values that can be generated are of the form n * ε/2. For f32
the 24 most significant random bits of a u32 are used and for f64 the
53 most significant bits of a u64 are used. The conversion uses the
multiplicative method: (rng.gen::<$uty>() >> N) as $ty * (ε/2).
See also: Open01 which samples from (0, 1), OpenClosed01 which
samples from (0, 1] and Rng::gen_range(0..1) which also samples from
[0, 1). Note that Open01 uses transmute-based methods which yield 1 bit
less precision but may perform faster on some architectures (on modern Intel
CPUs all methods have approximately equal performance).
Trait Implementations§
source§impl DistString for Standard
impl DistString for Standard
Note: the String is potentially left with excess capacity; optionally the
user may call string.shrink_to_fit() afterwards.
source§impl<T> Distribution<[T; 32]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 32]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 32]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 32]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 31]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 31]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 31]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 31]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 30]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 30]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 30]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 30]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 29]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 29]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 29]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 29]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 28]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 28]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 28]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 28]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 27]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 27]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 27]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 27]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 26]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 26]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 26]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 26]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 25]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 25]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 25]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 25]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 24]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 24]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 24]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 24]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 23]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 23]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 23]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 23]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 22]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 22]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 22]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 22]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 21]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 21]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 21]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 21]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 20]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 20]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 20]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 20]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 19]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 19]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 19]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 19]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 18]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 18]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 18]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 18]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 17]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 17]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 17]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 17]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 16]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 16]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 16]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 16]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 15]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 15]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 15]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 15]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 14]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 14]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 14]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 14]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 13]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 13]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 13]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 13]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 12]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 12]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 12]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 12]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 11]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 11]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 11]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 11]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 10]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 10]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 10]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 10]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 9]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 9]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 9]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 9]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 8]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 8]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 8]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 8]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 7]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 7]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 7]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 7]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 6]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 6]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 6]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 6]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 5]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 5]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 5]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 5]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 4]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 4]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 4]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 4]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 3]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 3]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 3]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 3]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 2]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 2]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 2]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 2]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 1]> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<[T; 1]> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, _rng: &mut R) -> [T; 1]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 1]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<[T; 0]> for Standard
impl<T> Distribution<[T; 0]> for Standard
source§fn sample<R>(&self, _rng: &mut R) -> [T; 0]where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> [T; 0]where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<()> for Standard
impl Distribution<()> for Standard
source§fn sample<R>(&self, _: &mut R)where
R: Rng + ?Sized,
fn sample<R>(&self, _: &mut R)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A> Distribution<(A,)> for Standardwhere
Standard: Distribution<A>,
impl<A> Distribution<(A,)> for Standardwhere Standard: Distribution<A>,
source§fn sample<R>(&self, _rng: &mut R) -> (A,)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A,)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A, B> Distribution<(A, B)> for Standardwhere
Standard: Distribution<A> + Distribution<B>,
impl<A, B> Distribution<(A, B)> for Standardwhere Standard: Distribution<A> + Distribution<B>,
source§fn sample<R>(&self, _rng: &mut R) -> (A, B)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A, B)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A, B, C> Distribution<(A, B, C)> for Standardwhere
Standard: Distribution<A> + Distribution<B> + Distribution<C>,
impl<A, B, C> Distribution<(A, B, C)> for Standardwhere Standard: Distribution<A> + Distribution<B> + Distribution<C>,
source§fn sample<R>(&self, _rng: &mut R) -> (A, B, C)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A, B, C)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A, B, C, D> Distribution<(A, B, C, D)> for Standardwhere
Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D>,
impl<A, B, C, D> Distribution<(A, B, C, D)> for Standardwhere Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D>,
source§fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A, B, C, D, E> Distribution<(A, B, C, D, E)> for Standardwhere
Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E>,
impl<A, B, C, D, E> Distribution<(A, B, C, D, E)> for Standardwhere Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E>,
source§fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A, B, C, D, E, F> Distribution<(A, B, C, D, E, F)> for Standardwhere
Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F>,
impl<A, B, C, D, E, F> Distribution<(A, B, C, D, E, F)> for Standardwhere Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F>,
source§fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A, B, C, D, E, F, G> Distribution<(A, B, C, D, E, F, G)> for Standardwhere
Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G>,
impl<A, B, C, D, E, F, G> Distribution<(A, B, C, D, E, F, G)> for Standardwhere Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G>,
source§fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A, B, C, D, E, F, G, H> Distribution<(A, B, C, D, E, F, G, H)> for Standardwhere
Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G> + Distribution<H>,
impl<A, B, C, D, E, F, G, H> Distribution<(A, B, C, D, E, F, G, H)> for Standardwhere Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G> + Distribution<H>,
source§fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G, H)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G, H)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A, B, C, D, E, F, G, H, I> Distribution<(A, B, C, D, E, F, G, H, I)> for Standardwhere
Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G> + Distribution<H> + Distribution<I>,
impl<A, B, C, D, E, F, G, H, I> Distribution<(A, B, C, D, E, F, G, H, I)> for Standardwhere Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G> + Distribution<H> + Distribution<I>,
source§fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G, H, I)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G, H, I)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A, B, C, D, E, F, G, H, I, J> Distribution<(A, B, C, D, E, F, G, H, I, J)> for Standardwhere
Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G> + Distribution<H> + Distribution<I> + Distribution<J>,
impl<A, B, C, D, E, F, G, H, I, J> Distribution<(A, B, C, D, E, F, G, H, I, J)> for Standardwhere Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G> + Distribution<H> + Distribution<I> + Distribution<J>,
source§fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G, H, I, J)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G, H, I, J)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A, B, C, D, E, F, G, H, I, J, K> Distribution<(A, B, C, D, E, F, G, H, I, J, K)> for Standardwhere
Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G> + Distribution<H> + Distribution<I> + Distribution<J> + Distribution<K>,
impl<A, B, C, D, E, F, G, H, I, J, K> Distribution<(A, B, C, D, E, F, G, H, I, J, K)> for Standardwhere Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G> + Distribution<H> + Distribution<I> + Distribution<J> + Distribution<K>,
source§fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G, H, I, J, K)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G, H, I, J, K)where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<A, B, C, D, E, F, G, H, I, J, K, L> Distribution<(A, B, C, D, E, F, G, H, I, J, K, L)> for Standardwhere
Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G> + Distribution<H> + Distribution<I> + Distribution<J> + Distribution<K> + Distribution<L>,
impl<A, B, C, D, E, F, G, H, I, J, K, L> Distribution<(A, B, C, D, E, F, G, H, I, J, K, L)> for Standardwhere Standard: Distribution<A> + Distribution<B> + Distribution<C> + Distribution<D> + Distribution<E> + Distribution<F> + Distribution<G> + Distribution<H> + Distribution<I> + Distribution<J> + Distribution<K> + Distribution<L>,
source§fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G, H, I, J, K, L)where
R: Rng + ?Sized,
fn sample<R>(&self, _rng: &mut R) -> (A, B, C, D, E, F, G, H, I, J, K, L)where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<E> Distribution<Address<E>> for Standardwhere
E: Environment,
impl<E> Distribution<Address<E>> for Standardwhere E: Environment,
§fn sample<R>(&self, rng: &mut R) -> Address<E>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Address<E>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<P> Distribution<Affine<P>> for Standardwhere
P: ShortWeierstrassParameters,
impl<P> Distribution<Affine<P>> for Standardwhere P: ShortWeierstrassParameters,
§fn sample<R>(&self, rng: &mut R) -> Affine<P>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Affine<P>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<P> Distribution<Affine<P>> for Standardwhere
P: TwistedEdwardsParameters,
impl<P> Distribution<Affine<P>> for Standardwhere P: TwistedEdwardsParameters,
§fn sample<R>(&self, rng: &mut R) -> Affine<P>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Affine<P>where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<F, const PREFIX: u16> Distribution<AleoID<F, PREFIX>> for Standardwhere
F: FieldTrait,
impl<F, const PREFIX: u16> Distribution<AleoID<F, PREFIX>> for Standardwhere F: FieldTrait,
source§fn sample<R>(&self, rng: &mut R) -> AleoID<F, PREFIX>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> AleoID<F, PREFIX>where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<BigInteger256> for Standard
impl Distribution<BigInteger256> for Standard
source§fn sample<R>(&self, rng: &mut R) -> BigInteger256where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> BigInteger256where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<BigInteger384> for Standard
impl Distribution<BigInteger384> for Standard
source§fn sample<R>(&self, rng: &mut R) -> BigInteger384where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> BigInteger384where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<E> Distribution<Boolean<E>> for Standardwhere
E: Environment,
impl<E> Distribution<Boolean<E>> for Standardwhere E: Environment,
§fn sample<R>(&self, rng: &mut R) -> Boolean<E>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Boolean<E>where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<const VARIANT: usize> Distribution<BooleanHash<VARIANT>> for Standard
impl<const VARIANT: usize> Distribution<BooleanHash<VARIANT>> for Standard
source§fn sample<R>(&self, rng: &mut R) -> BooleanHash<VARIANT>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> BooleanHash<VARIANT>where R: Rng + ?Sized,
Returns a random boolean hash.
§impl<E> Distribution<Field<E>> for Standardwhere
E: Environment,
impl<E> Distribution<Field<E>> for Standardwhere E: Environment,
§fn sample<R>(&self, rng: &mut R) -> Field<E>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Field<E>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<P> Distribution<Fp12<P>> for Standardwhere
P: Fp12Parameters,
impl<P> Distribution<Fp12<P>> for Standardwhere P: Fp12Parameters,
§fn sample<R>(&self, rng: &mut R) -> Fp12<P>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Fp12<P>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<P> Distribution<Fp2<P>> for Standardwhere
P: Fp2Parameters,
impl<P> Distribution<Fp2<P>> for Standardwhere P: Fp2Parameters,
§fn sample<R>(&self, rng: &mut R) -> Fp2<P>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Fp2<P>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<P> Distribution<Fp256<P>> for Standardwhere
P: Fp256Parameters,
impl<P> Distribution<Fp256<P>> for Standardwhere P: Fp256Parameters,
§fn sample<R>(&self, rng: &mut R) -> Fp256<P>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Fp256<P>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<P> Distribution<Fp384<P>> for Standardwhere
P: Fp384Parameters,
impl<P> Distribution<Fp384<P>> for Standardwhere P: Fp384Parameters,
§fn sample<R>(&self, rng: &mut R) -> Fp384<P>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Fp384<P>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<P> Distribution<Fp6<P>> for Standardwhere
P: Fp6Parameters,
impl<P> Distribution<Fp6<P>> for Standardwhere P: Fp6Parameters,
§fn sample<R>(&self, rng: &mut R) -> Fp6<P>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Fp6<P>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<E> Distribution<Group<E>> for Standardwhere
E: Environment,
impl<E> Distribution<Group<E>> for Standardwhere E: Environment,
§fn sample<R>(&self, rng: &mut R) -> Group<E>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Group<E>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<E, I> Distribution<Integer<E, I>> for Standardwhere
E: Environment,
I: IntegerType,
impl<E, I> Distribution<Integer<E, I>> for Standardwhere E: Environment, I: IntegerType,
§fn sample<R>(&self, rng: &mut R) -> Integer<E, I>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Integer<E, I>where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<NonZeroU128> for Standard
impl Distribution<NonZeroU128> for Standard
source§fn sample<R>(&self, rng: &mut R) -> NonZeroU128where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> NonZeroU128where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<NonZeroU16> for Standard
impl Distribution<NonZeroU16> for Standard
source§fn sample<R>(&self, rng: &mut R) -> NonZeroU16where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> NonZeroU16where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<NonZeroU32> for Standard
impl Distribution<NonZeroU32> for Standard
source§fn sample<R>(&self, rng: &mut R) -> NonZeroU32where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> NonZeroU32where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<NonZeroU64> for Standard
impl Distribution<NonZeroU64> for Standard
source§fn sample<R>(&self, rng: &mut R) -> NonZeroU64where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> NonZeroU64where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<NonZeroU8> for Standard
impl Distribution<NonZeroU8> for Standard
source§fn sample<R>(&self, rng: &mut R) -> NonZeroU8where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> NonZeroU8where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<NonZeroUsize> for Standard
impl Distribution<NonZeroUsize> for Standard
source§fn sample<R>(&self, rng: &mut R) -> NonZeroUsizewhere
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> NonZeroUsizewhere R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<Option<T>> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<Option<T>> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, rng: &mut R) -> Option<T>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Option<T>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<P> Distribution<Projective<P>> for Standardwhere
P: ShortWeierstrassParameters,
impl<P> Distribution<Projective<P>> for Standardwhere P: ShortWeierstrassParameters,
§fn sample<R>(&self, rng: &mut R) -> Projective<P>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Projective<P>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<P> Distribution<Projective<P>> for Standardwhere
P: TwistedEdwardsParameters,
impl<P> Distribution<Projective<P>> for Standardwhere P: TwistedEdwardsParameters,
§fn sample<R>(&self, rng: &mut R) -> Projective<P>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Projective<P>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<E> Distribution<Scalar<E>> for Standardwhere
E: Environment,
impl<E> Distribution<Scalar<E>> for Standardwhere E: Environment,
§fn sample<R>(&self, rng: &mut R) -> Scalar<E>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Scalar<E>where R: Rng + ?Sized,
T, using rng as the source of randomness.§impl<E> Distribution<StringType<E>> for Standardwhere
E: Environment,
impl<E> Distribution<StringType<E>> for Standardwhere E: Environment,
§fn sample<R>(&self, rng: &mut R) -> StringType<E>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> StringType<E>where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl<T> Distribution<Wrapping<T>> for Standardwhere
Standard: Distribution<T>,
impl<T> Distribution<Wrapping<T>> for Standardwhere Standard: Distribution<T>,
source§fn sample<R>(&self, rng: &mut R) -> Wrapping<T>where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Wrapping<T>where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<bool> for Standard
impl Distribution<bool> for Standard
source§fn sample<R>(&self, rng: &mut R) -> boolwhere
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> boolwhere R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<char> for Standard
impl Distribution<char> for Standard
source§fn sample<R>(&self, rng: &mut R) -> charwhere
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> charwhere R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<f32> for Standard
impl Distribution<f32> for Standard
source§fn sample<R>(&self, rng: &mut R) -> f32where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> f32where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<f64> for Standard
impl Distribution<f64> for Standard
source§fn sample<R>(&self, rng: &mut R) -> f64where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> f64where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<i128> for Standard
impl Distribution<i128> for Standard
source§fn sample<R>(&self, rng: &mut R) -> i128where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> i128where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<i16> for Standard
impl Distribution<i16> for Standard
source§fn sample<R>(&self, rng: &mut R) -> i16where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> i16where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<i32> for Standard
impl Distribution<i32> for Standard
source§fn sample<R>(&self, rng: &mut R) -> i32where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> i32where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<i64> for Standard
impl Distribution<i64> for Standard
source§fn sample<R>(&self, rng: &mut R) -> i64where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> i64where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<i8> for Standard
impl Distribution<i8> for Standard
source§fn sample<R>(&self, rng: &mut R) -> i8where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> i8where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<isize> for Standard
impl Distribution<isize> for Standard
source§fn sample<R>(&self, rng: &mut R) -> isizewhere
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> isizewhere R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<u128> for Standard
impl Distribution<u128> for Standard
source§fn sample<R>(&self, rng: &mut R) -> u128where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> u128where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<u16> for Standard
impl Distribution<u16> for Standard
source§fn sample<R>(&self, rng: &mut R) -> u16where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> u16where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<u32> for Standard
impl Distribution<u32> for Standard
source§fn sample<R>(&self, rng: &mut R) -> u32where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> u32where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<u64> for Standard
impl Distribution<u64> for Standard
source§fn sample<R>(&self, rng: &mut R) -> u64where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> u64where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<u8> for Standard
impl Distribution<u8> for Standard
source§fn sample<R>(&self, rng: &mut R) -> u8where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> u8where R: Rng + ?Sized,
T, using rng as the source of randomness.source§impl Distribution<usize> for Standard
impl Distribution<usize> for Standard
source§fn sample<R>(&self, rng: &mut R) -> usizewhere
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> usizewhere R: Rng + ?Sized,
T, using rng as the source of randomness.