Skip to main content

binius_field/
random.rs

1// Copyright 2024-2025 Irreducible Inc.
2
3use rand::{
4	distr::{Distribution, StandardUniform},
5	prelude::*,
6};
7
8/// A value that can be randomly generated
9pub trait Random {
10	/// Generate random value
11	fn random(rng: impl rand::Rng) -> Self;
12}
13
14impl<T> Random for T
15where
16	StandardUniform: Distribution<T>,
17{
18	fn random(mut rng: impl rand::Rng) -> Self {
19		rng.random()
20	}
21}