Skip to content

Commit 4767748

Browse files
committed
Better explanation of false positives
1 parent e05514a commit 4767748

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

example_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ func Example() {
1717

1818
// Check for membership.
1919
if blacklist.Likely(url) {
20-
fmt.Println(url, "seems to be shady")
20+
fmt.Println(url, "seems to be shady.")
21+
} else {
22+
fmt.Println(url, "has not yet been added to our blacklist.")
2123
}
22-
// Output: https://rascal.com seems to be shady
24+
// Output: https://rascal.com seems to be shady.
2325
}

filter.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
//
55
// A Bloom filter is a space-efficient probabilistic data structure
66
// used to test set membership. A member query returns either
7-
// ”likely in set” or ”definitely not in set”. Elements can be added,
8-
// but not removed. With more elements in the set, the probability of
9-
// false positives increases.
7+
// ”likely in set” or ”definitely not in set”. Only false positives
8+
// may occur: an element that has been added to the filter
9+
// will be identified as ”likely in set”.
10+
//
11+
// Elements can be added, but not removed. With more elements in the set,
12+
// the probability of false positives increases.
1013
//
1114
// Implementation
1215
//

0 commit comments

Comments
 (0)