arnaucube
arnaucube/miden-cryptoPublic Self-hosted repository
miden-crypto/src/rand/mod.rs
src/rand/mod.rsRaw
 1//! Pseudo-random element generation.
 2
 3use rand::RngCore;
 4pub use winter_crypto::{DefaultRandomCoin as WinterRandomCoin, RandomCoin, RandomCoinError};
 5pub use winter_utils::Randomizable;
 6
 7use crate::{Felt, FieldElement, Word, ZERO};
 8
 9mod rpo;
10pub use rpo::RpoRandomCoin;
11
12/// Pseudo-random element generator.
13///
14/// An instance can be used to draw, uniformly at random, base field elements as well as [Word]s.
15pub trait FeltRng: RngCore {
16    /// Draw, uniformly at random, a base field element.
17    fn draw_element(&mut self) -> Felt;
18
19    /// Draw, uniformly at random, a [Word].
20    fn draw_word(&mut self) -> Word;
21}