Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
11 lines (8 sloc) 539 Bytes
Bloom filter code expanded over the recipe posted by Raymond Hettinger in ActiveState site:
It requires the number of bits, number of probes, and a yielding hash function as shown in my fork of the recipe: (reproduced here for convenience)
def get_probes(bfilter, key):
hasher = Random(key).randrange
for _ in range(bfilter.num_probes):
array_index = hasher(len(bfilter.arr))
bit_index = hasher(32)
yield array_index, 1 << bit_index