structures-0.2: "Advanced" Data Structures

Safe HaskellSafe-Inferred

Data.Vector.Bloom.Util

Synopsis

Documentation

rehash :: Hashable a => Int -> a -> [Int]Source

Compute several hashes using a variant of Kirsch and Mitzenmacher's double hashing.

optimalHashes :: Int -> Int -> IntSource

optimalHashes n m calculates the optimal number of hash functions for a given number of entries n in a Bloom filter that is m bits wide.

k = m/n log 2

optimalWidth :: Int -> Double -> IntSource

optimalWidth n p calculate the optimal width m of a bloom filter given the expected number of entries n and target failure rate p at capacity.

m = -n log p / (log 2)^2