A few small improvements
This commit is contained in:
parent
677a2a39d4
commit
c05f239987
|
@ -10,7 +10,7 @@ pub struct PrimeOrderDomain<const ORDER: u64> {
|
|||
|
||||
impl<const ORDER: u64> Display for PrimeOrderDomain<{ ORDER }> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
||||
write!(f, "{:5}", self.val)
|
||||
write!(f, "{:20}", self.val)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,10 +56,7 @@ impl Generator {
|
|||
pub fn random<R: RngCore + CryptoRng>(&self, rng: &mut R) -> Hash {
|
||||
let mut hash = vec![PrimeOrderDomain::new(rng.gen_range(0..PRIME_ORDER))];
|
||||
for _i in 0..self.synthetic_max as usize {
|
||||
let mut result = PrimeOrderDomain::new(0);
|
||||
for _j in 0..self.threshold as usize {
|
||||
result = PrimeOrderDomain::new(rng.gen_range(0..PRIME_ORDER))
|
||||
}
|
||||
let mut result = PrimeOrderDomain::new(rng.gen_range(0..PRIME_ORDER));
|
||||
hash.push(result);
|
||||
}
|
||||
Hash(hash)
|
||||
|
@ -229,13 +226,13 @@ mod tests {
|
|||
fn it_works() {
|
||||
let mut rng = OsRng;
|
||||
let s = 3u64;
|
||||
let t = 4u64;
|
||||
let t = 6u64;
|
||||
let dhf = Generator::generate(&mut rng, s, t);
|
||||
|
||||
let mut solver = Solver::new(s, t);
|
||||
for i in 0..10 {
|
||||
// These are the indexes which are to be random...you can try swapping them around..
|
||||
if i != 5 && i != 2 && i != 8 {
|
||||
if i != 2 && i != 5 && i != 8 {
|
||||
let x0: u64 = rng.gen_range(0..PRIME_ORDER);
|
||||
let hash = dhf.hash(PrimeOrderDomain::new(x0));
|
||||
solver.add_hash(hash);
|
||||
|
|
Loading…
Reference in New Issue