Change test_rng import to ark-std

This commit is contained in:
ValarDragon
2020-12-11 19:49:55 -06:00
committed by Pratyush Mishra
parent b17b17efcc
commit 530d618cca
42 changed files with 84 additions and 58 deletions

View File

@@ -29,6 +29,11 @@ members = [
"ed_on_mnt4_298",
]
[patch.crates-io]
ark-ff = { path = '../algebra/ff' }
ark-ec = { path = '../algebra/ec'}
[profile.release]
opt-level = 3
lto = "thin"

View File

@@ -20,7 +20,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -67,7 +67,7 @@
//! # use ark_bls12_377::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `G1` elements.
//! let a_native = G1Projective::rand(&mut rng);
@@ -112,7 +112,7 @@
//! # use ark_bls12_377::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate random `G1` and `G2` elements.
//! let a_native = G1Projective::rand(&mut rng);

View File

@@ -1,9 +1,10 @@
#![allow(unused_imports)]
use ark_ff::{
fields::{Field, FpParameters, PrimeField, SquareRootField},
test_rng, One, Zero,
One, Zero,
};
use ark_serialize::CanonicalSerialize;
use ark_std::test_rng;
use ark_ec::{models::SWModelParameters, AffineCurve, PairingEngine, ProjectiveCurve};
use core::ops::{AddAssign, MulAssign};

View File

@@ -4,9 +4,10 @@ use ark_ff::{
fp6_3over2::Fp6Parameters, FftField, FftParameters, Field, Fp2Parameters, FpParameters,
PrimeField, SquareRootField,
},
test_rng, One, UniformRand, Zero,
One, UniformRand, Zero,
};
use ark_serialize::{buffer_bit_byte_size, CanonicalSerialize};
use ark_std::test_rng;
use core::{
cmp::Ordering,
ops::{AddAssign, MulAssign, SubAssign},

View File

@@ -2,9 +2,10 @@
use ark_ec::{models::SWModelParameters, AffineCurve, PairingEngine, ProjectiveCurve};
use ark_ff::{
fields::{Field, FpParameters, PrimeField, SquareRootField},
test_rng, One, Zero,
One, Zero,
};
use ark_serialize::CanonicalSerialize;
use ark_std::test_rng;
use core::ops::{AddAssign, MulAssign};
use rand::Rng;

View File

@@ -2,9 +2,10 @@
use ark_ec::{models::SWModelParameters, AffineCurve, PairingEngine, ProjectiveCurve};
use ark_ff::{
fields::{Field, FpParameters, PrimeField, SquareRootField},
test_rng, One, Zero,
One, Zero,
};
use ark_serialize::CanonicalSerialize;
use ark_std::test_rng;
use core::ops::{AddAssign, MulAssign};
use rand::Rng;

View File

@@ -1,5 +1,6 @@
use ark_ec::{AffineCurve, PairingEngine, ProjectiveCurve};
use ark_ff::{test_rng, Field, One, PrimeField};
use ark_ff::{Field, One, PrimeField};
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -1,4 +1,5 @@
use ark_ff::{test_rng, Field, PrimeField};
use ark_ff::{Field, PrimeField};
use ark_std::test_rng;
use ark_serialize::{buffer_bit_byte_size, CanonicalSerialize};
use rand::Rng;

View File

@@ -1,5 +1,6 @@
use ark_ec::{AffineCurve, PairingEngine, ProjectiveCurve};
use ark_ff::{test_rng, Field, One, PrimeField};
use ark_ff::{Field, One, PrimeField};
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -1,4 +1,5 @@
use ark_ff::{test_rng, Field, PrimeField};
use ark_ff::{Field, PrimeField};
use ark_std::test_rng;
use ark_serialize::{buffer_bit_byte_size, CanonicalSerialize};
use rand::Rng;

View File

@@ -6,7 +6,8 @@ pub mod fields {
use rand::{self, SeedableRng};
use rand_xorshift::XorShiftRng;
use ark_ff::{test_rng, BitIteratorLE, Field, UniformRand};
use ark_ff::{BitIteratorLE, Field, UniformRand};
use ark_std::test_rng;
use ark_r1cs_std::prelude::*;
use ark_relations::r1cs::{ConstraintSystem, SynthesisError};
use ark_std::vec::Vec;

View File

@@ -19,7 +19,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -66,7 +66,7 @@
//! # use ark_ed_on_bls12_377::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Edwards` elements.
//! let a_native = EdwardsProjective::rand(&mut rng);

View File

@@ -1,5 +1,5 @@
use ark_ec::{AffineCurve, ProjectiveCurve};
use ark_ff::test_rng;
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -1,4 +1,4 @@
use ark_ff::test_rng;
use ark_std::test_rng;
use rand::Rng;
use crate::{Fq, Fr};

View File

@@ -19,7 +19,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -66,7 +66,7 @@
//! # use ark_ed_on_bls12_381::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Edwards` elements.
//! let a_native = EdwardsProjective::rand(&mut rng);

View File

@@ -1,5 +1,6 @@
use ark_ec::{AffineCurve, ProjectiveCurve};
use ark_ff::{bytes::FromBytes, test_rng, Zero};
use ark_ff::{bytes::FromBytes, Zero};
use ark_std::test_rng;
use core::str::FromStr;
use rand::Rng;

View File

@@ -3,8 +3,9 @@ use ark_ff::{
biginteger::BigInteger256 as BigInteger,
bytes::{FromBytes, ToBytes},
fields::{Field, LegendreSymbol::*, SquareRootField},
test_rng, One, Zero,
One, Zero,
};
use ark_std::test_rng;
use ark_curve_tests::fields::*;

View File

@@ -19,7 +19,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -66,7 +66,7 @@
//! # use ark_ed_on_bn254::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Edwards` elements.
//! let a_native = EdwardsProjective::rand(&mut rng);

View File

@@ -1,5 +1,6 @@
use ark_ec::{AffineCurve, ProjectiveCurve};
use ark_ff::{bytes::FromBytes, test_rng, Zero};
use ark_ff::{bytes::FromBytes, Zero};
use ark_std::test_rng;
use core::str::FromStr;
use rand::Rng;

View File

@@ -3,8 +3,9 @@ use ark_ff::{
biginteger::BigInteger256 as BigInteger,
bytes::{FromBytes, ToBytes},
fields::{Field, LegendreSymbol::*, SquareRootField},
test_rng, One, Zero,
One, Zero,
};
use ark_std::test_rng;
use ark_curve_tests::fields::*;

View File

@@ -19,7 +19,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -66,7 +66,7 @@
//! # use ark_ed_on_bw6_761::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Edwards` elements.
//! let a_native = EdwardsProjective::rand(&mut rng);

View File

@@ -20,7 +20,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -67,7 +67,7 @@
//! # use ark_ed_on_cp6_782::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Edwards` elements.
//! let a_native = EdwardsProjective::rand(&mut rng);

View File

@@ -1,5 +1,5 @@
use ark_ec::{AffineCurve, ProjectiveCurve};
use ark_ff::test_rng;
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -1,4 +1,4 @@
use ark_ff::test_rng;
use ark_std::test_rng;
use rand::Rng;
use crate::{Fq, Fr};

View File

@@ -19,7 +19,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -66,7 +66,7 @@
//! # use ark_ed_on_mnt4_298::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Edwards` elements.
//! let a_native = EdwardsProjective::rand(&mut rng);

View File

@@ -1,5 +1,5 @@
use ark_ec::{AffineCurve, ProjectiveCurve};
use ark_ff::test_rng;
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -1,4 +1,4 @@
use ark_ff::test_rng;
use ark_std::test_rng;
use rand::Rng;
use crate::fields::*;

View File

@@ -19,7 +19,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -66,7 +66,7 @@
//! # use ark_ed_on_mnt4_753::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Edwards` elements.
//! let a_native = EdwardsProjective::rand(&mut rng);

View File

@@ -1,5 +1,5 @@
use ark_ec::{AffineCurve, ProjectiveCurve};
use ark_ff::test_rng;
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -1,4 +1,4 @@
use ark_ff::test_rng;
use ark_std::test_rng;
use rand::Rng;
use crate::{Fq, Fr};

View File

@@ -20,7 +20,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -67,7 +67,7 @@
//! # use ark_mnt4_298::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `G1` elements.
//! let a_native = G1Projective::rand(&mut rng);
@@ -112,7 +112,7 @@
//! # use ark_mnt4_298::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate random `G1` and `G2` elements.
//! let a_native = G1Projective::rand(&mut rng);

View File

@@ -1,5 +1,6 @@
use ark_ec::{AffineCurve, PairingEngine, ProjectiveCurve};
use ark_ff::{test_rng, Field, One, PrimeField, UniformRand};
use ark_ff::{Field, One, PrimeField, UniformRand};
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -1,4 +1,5 @@
use ark_ff::{test_rng, Field};
use ark_ff::Field;
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -20,7 +20,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -67,7 +67,7 @@
//! # use ark_mnt4_753::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `G1` elements.
//! let a_native = G1Projective::rand(&mut rng);
@@ -112,7 +112,7 @@
//! # use ark_mnt4_753::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate random `G1` and `G2` elements.
//! let a_native = G1Projective::rand(&mut rng);

View File

@@ -1,5 +1,6 @@
use ark_ec::{AffineCurve, PairingEngine, ProjectiveCurve};
use ark_ff::{test_rng, Field, One, PrimeField, UniformRand};
use ark_ff::{Field, One, PrimeField, UniformRand};
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -1,4 +1,5 @@
use ark_ff::{test_rng, Field};
use ark_ff::Field;
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -20,7 +20,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -67,7 +67,7 @@
//! # use ark_mnt6_298::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `G1` elements.
//! let a_native = G1Projective::rand(&mut rng);
@@ -112,7 +112,7 @@
//! # use ark_mnt6_298::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate random `G1` and `G2` elements.
//! let a_native = G1Projective::rand(&mut rng);

View File

@@ -1,5 +1,6 @@
use ark_ec::{AffineCurve, PairingEngine, ProjectiveCurve};
use ark_ff::{test_rng, Field, One, PrimeField, UniformRand};
use ark_ff::{Field, One, PrimeField, UniformRand};
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -1,7 +1,8 @@
use ark_ff::{
fields::{models::fp6_2over3::*, quadratic_extension::QuadExtParameters},
test_rng, Field,
Field,
};
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -20,7 +20,7 @@
//! let cs = ConstraintSystem::<Fq>::new_ref();
//! // This rng is just for test purposes; do not use it
//! // in real applications.
//! let mut rng = ark_ff::test_rng();
//! let mut rng = ark_std::test_rng();
//!
//! // Generate some random `Fq` elements.
//! let a_native = Fq::rand(&mut rng);
@@ -67,7 +67,7 @@
//! # use ark_mnt6_753::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate some random `G1` elements.
//! let a_native = G1Projective::rand(&mut rng);
@@ -112,7 +112,7 @@
//! # use ark_mnt6_753::{*, constraints::*};
//!
//! # let cs = ConstraintSystem::<Fq>::new_ref();
//! # let mut rng = ark_ff::test_rng();
//! # let mut rng = ark_std::test_rng();
//!
//! // Generate random `G1` and `G2` elements.
//! let a_native = G1Projective::rand(&mut rng);

View File

@@ -1,5 +1,6 @@
use ark_ec::{AffineCurve, PairingEngine, ProjectiveCurve};
use ark_ff::{test_rng, Field, One, PrimeField, UniformRand};
use ark_ff::{Field, One, PrimeField, UniformRand};
use ark_std::test_rng;
use rand::Rng;
use crate::*;

View File

@@ -1,7 +1,8 @@
use ark_ff::{
fields::{models::fp6_2over3::*, quadratic_extension::QuadExtParameters},
test_rng, Field,
Field,
};
use ark_std::test_rng;
use rand::Rng;
use crate::*;