pub trait Random: Sized {
// Required method
fn random(rng: impl CryptoRngCore) -> Self;
// Provided method
fn random_n<Container: FromIterator<Self>>(
rng: impl CryptoRngCore,
size: usize,
) -> Container { ... }
}Expand description
A trait for getting a random value for a type. Will be replaced by the random feature
once it is included in std (https://github.com/rust-lang/rust/issues/130703).
Required Methods§
fn random(rng: impl CryptoRngCore) -> Self
Provided Methods§
fn random_n<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, ) -> Container
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl<C: Curve> Random for CurveKey<C>
impl<C: Curve, M: Positive> Random for CurveKeys<C, M>
impl<F: FieldExtension> Random for SubfieldElement<F>
impl<T> Random for Twhere
Standard: Distribution<T>,
Generalise so that rand::random() can be used for any type that implements Random.