Skip to main content

Random

Trait Random 

Source
pub trait Random: Sized {
    // Required method
    fn random(rng: impl CryptoRngCore) -> Self;

    // Provided methods
    fn random_n<Container: FromIterator<Self>>(
        rng: impl CryptoRngCore,
        size: usize,
    ) -> Container { ... }
    fn random_array<M: Positive>(rng: impl CryptoRngCore) -> HeapArray<Self, M> { ... }
}
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§

Source

fn random(rng: impl CryptoRngCore) -> Self

Provided Methods§

Source

fn random_n<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, ) -> Container

Source

fn random_array<M: Positive>(rng: impl CryptoRngCore) -> HeapArray<Self, M>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Random for u8

Source§

fn random(rng: impl CryptoRngCore) -> Self

Source§

fn random_n<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, ) -> Container

Source§

impl Random for usize

Source§

fn random(rng: impl CryptoRngCore) -> Self

Source§

fn random_n<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, ) -> Container

Source§

impl<T1: Random, T2: Random> Random for (T1, T2)

Source§

fn random(source: impl CryptoRngCore) -> Self

Source§

impl<T: Random> Random for Arc<T>

Source§

fn random(source: impl CryptoRngCore) -> Self

Implementors§

Source§

impl Random for BaseField25519

Source§

impl Random for Gf2

Source§

impl Random for Mersenne107

Source§

impl Random for Scalar25519

Source§

impl Random for Seed

Source§

impl<A: Random, B: Random> Random for PairwiseAuthKey<A, B>

Source§

impl<C: Curve> Random for Point<C>

Source§

impl<F: FieldExtension, Exp: PowPairExponent> Random for PowPair<F, Exp>

Source§

impl<F: FieldExtension, M: Positive> Random for CorrelatedUnauthenticatedTriples<F, M>

Source§

impl<F: FieldExtension, M: Positive> Random for Singlets<F, M>

Source§

impl<F: FieldExtension, M: Positive> Random for Triples<F, M>

Source§

impl<F: FieldExtension, M: Positive> Random for UnauthenticatedTriples<F, M>

Source§

impl<F: FieldExtension, N: Positive, Exp: PowPairExponent> Random for PowPairs<F, N, Exp>

Source§

impl<F: FieldExtension> Random for FieldElement<F>

Source§

impl<F: FieldExtension> Random for Singlet<F>

Source§

impl<F: FieldExtension> Random for SubfieldElement<F>

Source§

impl<F: FieldExtension> Random for Triple<F>

Source§

impl<F: FieldExtension> Random for UnauthenticatedTriple<F>

Source§

impl<P: Gf2ExtParams, const LIMBS: usize> Random for Gf2Ext<P, LIMBS>

Source§

impl<T: Random + Sized, M: Positive, N: Positive, O: 'static> Random for HeapMatrix<T, M, N, O>

Source§

impl<T: Sized + Random, M: Positive> Random for HeapArray<T, M>

Source§

impl<V, A, B> Random for PairwiseAuthShare<V, A, B>
where for<'a> V: Random + Clone + Mul<&'a A, Output = B>, A: Random + Clone, B: Random + Clone + ConstantTimeEq + SubAssign + for<'b> Add<&'b B, Output = B>,