Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v2.0.0
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (20 sloc) 0.587 kb
#!/usr/bin/env ruby
require 'bloomfilter-rb'
WORDS = %w(duck penguin bear panda)
TEST = %w(penguin moose racooon)
bf = BloomFilter::Native.new(:size => 100, :hashes => 2, :seed => 1, :bucket => 3, :raise => false)
WORDS.each { |w| bf.insert(w) }
TEST.each do |w|
puts "#{w}: #{bf.include?(w)}"
end
bf.stats
# penguin: true
# moose: false
# racooon: false
#
# Number of filter buckets (m): 100
# Number of bits per buckets (b): 1
# Number of filter elements (n): 4
# Number of filter hashes (k) : 4
# Raise on overflow? (r) : false
# Predicted false positive rate = 0.05%
Jump to Line
Something went wrong with that request. Please try again.