File tree 2 files changed +5
-25
lines changed
2 files changed +5
-25
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package bloom_test
3
3
import (
4
4
"fmt"
5
5
"github.com/yourbasic/bloom"
6
- "math/rand"
7
6
"strconv"
8
7
)
9
8
@@ -26,30 +25,6 @@ func Example_basics() {
26
25
// Output: https://rascal.com seems to be shady.
27
26
}
28
27
29
- // Estimate the number of false positives.
30
- func Example_falsePositives () {
31
- // Create a Bloom filter with room for n elements
32
- // at a false-positives rate less than 1/p.
33
- n , p := 10000 , 100
34
- filter := bloom .New (n , p )
35
-
36
- // Add n random strings.
37
- for i := 0 ; i < n ; i ++ {
38
- filter .Add (strconv .Itoa (rand .Int ()))
39
- }
40
-
41
- // Do n random lookups and count the (mostly accidental) hits.
42
- // It shouldn't be much more than n/p, and hopefully less.
43
- count := 0
44
- for i := 0 ; i < n ; i ++ {
45
- if filter .Test (strconv .Itoa (rand .Int ())) {
46
- count ++
47
- }
48
- }
49
- fmt .Println (count , "mistakes were made." )
50
- // Output: 26 mistakes were made.
51
- }
52
-
53
28
// Compute the union of two filters.
54
29
func ExampleFilter_Union () {
55
30
// Create two Bloom filters, each with room for 1000 elements
Original file line number Diff line number Diff line change 49
49
// The internal data representation is different for big-endian
50
50
// and little-endian machines.
51
51
//
52
+ // Typical use case
53
+ //
54
+ // The Basics example contains a typcial use case:
55
+ // a blacklist of shady websites.
56
+ //
52
57
package bloom
53
58
54
59
import (
You can’t perform that action at this time.
0 commit comments