From 044810991ada1bb404180783c7721a3dc8f5209e Mon Sep 17 00:00:00 2001 From: Isidro Arias Date: Thu, 6 Apr 2023 11:21:52 +0200 Subject: [PATCH] fix type --- data_structures/hashing/bloom_filter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data_structures/hashing/bloom_filter.py b/data_structures/hashing/bloom_filter.py index fa3581e95..c454c16ff 100644 --- a/data_structures/hashing/bloom_filter.py +++ b/data_structures/hashing/bloom_filter.py @@ -45,7 +45,7 @@ class Bloom: def hash(self, value): res = 0b0 - for func in HASH_FUNCTIONS: + for func in self.HASH_FUNCTIONS: b = func(value.encode()).digest() position = int.from_bytes(b, "little") % self.size res |= 2**position @@ -77,7 +77,7 @@ def test_probability(m=64, n=20): for a in added: b.add(a) - k = len(b.HASH_FUNCIONS) + k = len(b.HASH_FUNCTIONS) n_ones = bin(b.bitstring).count("1") expected_probability = (n_ones / m) ** k