bloom-filter icon indicating copy to clipboard operation
bloom-filter copied to clipboard

Doesn't work for numbers

Open mLuby opened this issue 6 years ago • 1 comments

Here's a minimal test to demonstrate.

const BloomFilter = require("bloom-filter")
const bf = BloomFilter.create(3, .01)
bf.insert(1).insert(2).insert(3)
console.log(bf.contains(1)) // expected: true; actual: true
console.log(bf.contains(4)) // expected: false; actual: true

mLuby avatar Mar 13 '19 01:03 mLuby

The hashing function and whatnot isn't really designed for raw numbers.

If you convert the numbers to strings then things will work as expected.

only-cliches avatar Jun 16 '19 20:06 only-cliches