Skip to content

Instantly share code, notes, and snippets.

@kendrikat
Last active December 16, 2017 16:24
Show Gist options
  • Save kendrikat/ef3171531acdbd8a9e845c78340c06f9 to your computer and use it in GitHub Desktop.
Save kendrikat/ef3171531acdbd8a9e845c78340c06f9 to your computer and use it in GitHub Desktop.
advent_judge.rb
def adv(ga = 65, gb = 8921, n = 40000000)
judge = 0
n.times do
ga = ga * 16807 % 2147483647
gb = gb * 48271 % 2147483647
judge += 1 if (ga & 65535) == (gb & 65535)
end
judge
end
puts adv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment