Create a gist now

Instantly share code, notes, and snippets.

@cipepser /main.go
Last active Jan 31, 2017

What would you like to do?
func main() {
var bf BloomFilter
// 要素の追加
Add(&bf, "1")
Add(&bf, "2")
Add(&bf, "3")
Add(&bf, "4")
Add(&bf, "5")
// 要素が含まれているか検証
fmt.Println(Exists(&bf, "1")) // true
fmt.Println(Exists(&bf, "2")) // true
fmt.Println(Exists(&bf, "3")) // true
fmt.Println(Exists(&bf, "4")) // true
fmt.Println(Exists(&bf, "5")) // true
fmt.Println(Exists(&bf, "10")) // false
fmt.Println(Exists(&bf, "999")) // true(偽陽性)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment