Open vlopes11 opened 3 years ago
To add a little bit of context, we're evaluating whether we can/should replace UniformRand
by methods on traits (eg: Field::rand
or Commitment::sample_randomness
). The upside is that we can reduce our custom randomness infrastructure, which makes it so that users have one less interface to worry about.
The downside is that we can longer say something like T: UniformRand
in trait bounds, and the rand
infrastructure would require us to do something like Standard: Distribution<T>
, which can be a bit more clunky. Fortunately, in most cases, T
is a Field
or a Curve
or a Polynomial
, so we can just move the rand
function to those traits. (Indeed, in the UnivariatePolynomial
s we already have a custom rand
function that takes as input the degree of the sampled polynomial.)
Summary
UniformRand
can be replaced by the providers inrand
to reduce code complexityProblem Definition
The base field types need to implement
Standard: Distribution<T>
as RNG requirement. Example:https://github.com/arkworks-rs/algebra/blob/master/ec/src/models/short_weierstrass_jacobian.rs#L351-L363
This is superseded by CryptoRng that wraps cryptographic requirements without requiring concrete implementations in
T
.Proposal
UniformRand
byRngCore + CryptoRng
UniformRand
For Admin Use