pub trait RandomGenerator<T> {
    // Required method
    fn generate_random() -> Result<T, Box<dyn Error>>;
}
Expand description

Defines a trait for generating random values of a given type.

This trait is intended to abstract the generation of random values for different types, providing a uniform interface.

Required Methods§

source

fn generate_random() -> Result<T, Box<dyn Error>>

Generates a random value of type T.

Returns

A Result containing the random value of type T, or an error if the generation fails.

Errors

Returns an error if the random value generation fails.

Implementations on Foreign Types§

source§

impl RandomGenerator<BigUint> for BigUint

source§

fn generate_random() -> Result<BigUint, Box<dyn Error>>

Generates a random BigUint.

Returns

A Result containing the random BigUint, or an error if the generation fails.

Errors

Returns an error if the conversion from bytes to BigUint fails.

source§

impl RandomGenerator<Eq> for Eq

source§

fn generate_random() -> Result<Eq, Box<dyn Error>>

Generates a random Fq.

Returns

A Result containing the random Fq, or an error if the generation fails.

Errors

Returns an error if the conversion from bytes to Fq fails.

source§

impl RandomGenerator<Fp> for Fp

source§

fn generate_random() -> Result<Fp, Box<dyn Error>>

Generates a random Fp.

Returns

A Result containing the random Fp, or an error if the generation fails.

Errors

Returns an error if the conversion from bytes to Fp fails.

source§

impl RandomGenerator<Ep> for Ep

source§

fn generate_random() -> Result<Ep, Box<dyn Error>>

Generates a random Ep.

Returns

A Result containing the random Ep, or an error if the generation fails.

Errors

Returns an error if the conversion from bytes to Ep fails.

source§

impl RandomGenerator<Scalar> for Scalar

source§

fn generate_random() -> Result<Scalar, Box<dyn Error>>

Generates a random Scalar.

Returns

A Result containing the random Scalar, or an error if the generation fails.

Errors

Returns an error if the conversion from bytes to Scalar fails.

source§

impl RandomGenerator<RistrettoPoint> for RistrettoPoint

source§

fn generate_random() -> Result<RistrettoPoint, Box<dyn Error>>

Generates a random RistrettoPoint.

Returns

A Result containing the random RistrettoPoint, or an error if the generation fails.

Errors

Returns an error if the conversion from bytes to RistrettoPoint fails.

source§

impl RandomGenerator<Fq> for Fq

source§

fn generate_random() -> Result<Fq, Box<dyn Error>>

Generates a random Fq.

Returns

A Result containing the random Fq, or an error if the generation fails.

Errors

Returns an error if the conversion from bytes to Fq fails.

Implementors§