Skip to content

BloomFilter with string doesn't work with .Net Core #36

@sebfischer83

Description

@sebfischer83

Hi,

BloomFilter uses GetHashCode, which yields for strings no deterministic value.
This means every test returns true.

     Advanced.Algorithms.DataStructures.BloomFilter<string> bloomFilter = new Advanced.Algorithms.DataStructures.BloomFilter<string>(10);
            bloomFilter.AddKey("foo");
            bloomFilter.AddKey("bar");
            bloomFilter.AddKey("apple");
            bloomFilter.AddKey("orange");
            bloomFilter.AddKey("banana");

            bloomFilter.KeyExists("bar").ShouldBe(true);
            bloomFilter.KeyExists("ba111r").ShouldBe(true); // is true
            bloomFilter.KeyExists("banana").ShouldBe(true);
            bloomFilter.KeyExists("dfs11j").ShouldBe(false);`// is also true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions