pub trait Samplable {
// Required methods
fn random<R: RngCore>(rng: &mut R) -> Self;
fn random_vartime<R: RngCore>(rng: &mut R) -> Self;
}Expand description
Uniformly samples an instance of Self from source of randomness
This trait is implemented for scalars in all their variations: Scalar<E>,
SecretScalar<E>, NonZero<Scalar<E>>, etc.
Under the hood, it uses NonZero::<Scalar<E>>::{random, random_vartime}
methods.
Required Methods§
Sourcefn random<R: RngCore>(rng: &mut R) -> Self
fn random<R: RngCore>(rng: &mut R) -> Self
Uniformly samples an instance of Self from source of randomness
using constant-time method
Under the hood, it uses NonZero::<Scalar<E>>::random() method,
therefore it shares the same guarantees and performance drawbacks.
Refer to its documentation to learn more.
Sourcefn random_vartime<R: RngCore>(rng: &mut R) -> Self
fn random_vartime<R: RngCore>(rng: &mut R) -> Self
Uniformly samples an instance of Self from source of randomness
using vartime method
Under the hood, it uses NonZero::<Scalar<E>>::random_vartime() method,
therefore it shares the same guarantees and performance drawbacks.
Refer to its documentation to learn more.
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.