예제 #1
0
        public void CheckParameterCalculation(long expectedItems, long errorRate, int expectedNumBits, int expectedNumHashFunctions)
        {
            IBloomFilterParameters parameters = BloomUtils.CalculateBloomParameters(expectedItems, errorRate);

            Assert.AreEqual(expectedNumBits, parameters.NumberOfBits);
            Assert.AreEqual(expectedNumHashFunctions, parameters.NumberOfHashFunctions);

            CheckErrorRate(expectedItems, errorRate, parameters);
        }
예제 #2
0
        private static long CalculateErrorRate(long expectedItems, IBloomFilterParameters parameters)
        {
            double calcErrorRate = BloomUtils.CalculateErrorRate(expectedItems, parameters);

            return(Convert.ToInt64(1 / calcErrorRate));
        }