### Question:
FingerprintMixer { long mix(long fingerprint) { return ((fingerprint + mAddend) * mMultiplicand); } FingerprintMixer(SecretKey secretKey, byte[] salt);  static final int SALT_LENGTH_BYTES; }### Answer:
@Test public void mix_randomlyDistributesBits() throws Exception { int iterations = 100_000; float tolerance = 0.1f; int[] totals = new int[64]; for (int i = 0; i < iterations; i++) { long n = mFingerprintMixer.mix(mSeededRandom.nextLong()); for (int j = 0; j < 64; j++) { int bit = (int) (n >> j & 1); totals[j] += bit; } } for (int i = 0; i < 64; i++) { float mean = ((float) totals[i]) / iterations; float diff = Math.abs(mean - 0.5f); assertThat(diff).isLessThan(tolerance); } }
@Test public void mix_doesNotProduceSameNumberAsInput() { int iterations = 100_000; for (int i = 0; i < iterations; i++) { assertThat(mFingerprintMixer.mix(i)).isNotEqualTo(i); } }