Created
October 29, 2016 06:44
-
-
Save guilherme/96d1e41a1fcada6f006435672686e1b9 to your computer and use it in GitHub Desktop.
city hash "analysis"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cityhash' | |
keywords = (0..4).to_a.inject(('a'..'z').to_a) do |perms, t| | |
perms = ('a'..'z').to_a.product(perms) | |
end.collect(&:join) | |
mod2_zero = 0 | |
mod2_one = 0 | |
keywords.each { |k| (CityHash.hash32(k) % 2) == 0 ? (mod2_zero += 1) : (mod2_one += 1) } | |
puts mod2_zero | |
puts mod2_one |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment