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