Skip to content

Instantly share code, notes, and snippets.

@kazuho
Created December 21, 2022 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuho/eede3269e73ba2e03bb9e9d068cd30df to your computer and use it in GitHub Desktop.
Save kazuho/eede3269e73ba2e03bb9e9d068cd30df to your computer and use it in GitHub Desktop.
n = 200
m = 63
q = 16
c = 0
1_000_000.times do
buckets = Array.new(m, 0)
n.times do
slot = rand(m)
buckets[slot] += 1
if buckets[slot] > q then
c += 1
break
end
end
end
puts c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment