DEV Community

Discussion on: Let's Implement a Bloom Filter in Go

Collapse
 
theodesp profile image
Theofanis Despoudis

Daniel, this was just for convenience. While it is possible to have tons of hash functions, you only need a few of them. The real case with the k parameter is that you need to calculate the optimal value of it based on the error rate you would like to achieve.

Most of the times k > len(hasnFuncs) so you need to feed the item in all functions k times in a predictable manner.

That means you have to create a function with no side-effects that get a byte array parameter, hashes k times with the hasnFuncs and returns an integer for the position.

Collapse
 
dangolant profile image
Daniel Golant

Thanks Theofanis, makes sense!