RosettaCodeData/Task/Sleeping-Beauty-problem/Crystal/sleeping-beauty-problem.cr
2026-04-30 12:34:36 -04:00

15 lines
192 B
Crystal

iterations = 10_000_000
wakings = heads = 0
r = Random.new
iterations.times do
wakings += 1
if r.next_bool # heads?
heads += 1
else
wakings += 1
end
end
puts heads/wakings