Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
city hash "analysis"
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