Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        private static long CalculateErrorRate(long expectedItems, IBloomFilterParameters parameters)
        {
            double calcErrorRate = BloomUtils.CalculateErrorRate(expectedItems, parameters);

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