private static long NextShift(Random random, long scale) { long result = scale; while (!AffineHash.Coprime(result, scale)) { result = AffineHash.NextFactor(random, 0L); } return(result); }
/// <summary> /// Initializes a new instance of the <see cref="AffineHash"/> class. /// </summary> /// <param name="random">The random number generator that will select a shift factor.</param> /// <param name="scale">The scale factor for the hash.</param> private AffineHash(Random random, long scale) : this(scale, AffineHash.NextShift(random, scale)) { }
public AffineHash(Random random) : this(random, AffineHash.NextScale(random)) { }
private static long NextScale(Random random) { return(AffineHash.NextFactor(random, 1L)); }