Skip to main content

FieldRandom

Trait FieldRandom 

Source
pub trait FieldRandom: Sized {
    // Required method
    fn random(rng: &mut (impl CryptoRng + Rng)) -> Self;
}
Expand description

Trait for generating cryptographically secure random field elements.

Separated from FieldOps so that downstream code that doesn’t need randomness is free of the rand dependency.

Required Methods§

Source

fn random(rng: &mut (impl CryptoRng + Rng)) -> Self

Sample a uniformly random element using a cryptographic RNG.

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§

Source§

impl FieldRandom for F2Element

Source§

impl<MOD, const LIMBS: usize> FieldRandom for FpElement<MOD, LIMBS>
where MOD: ConstPrimeMontyParams<LIMBS>,

Source§

impl<MOD, const LIMBS: usize, const M: usize, const N: usize, P, TSCONSTS> FieldRandom for FpExt<MOD, LIMBS, M, N, P, TSCONSTS>
where MOD: ConstPrimeMontyParams<LIMBS>, P: IrreduciblePoly<MOD, LIMBS, M>, TSCONSTS: TonelliShanksConstants<MOD, LIMBS, M, N>,

Source§

impl<const LIMBS: usize, P> FieldRandom for F2Ext<LIMBS, P>
where P: BinaryIrreducible<LIMBS>,