Weird Fediverse argument about Coins and Clocks
Created on 2020-08-25T09:11:31.089468
- Postulate: for any binary choice question, flipping a coin will obtain the correct answer 50% of the time.
- Attempted refutation: a coin will not guess a particular hour of the day.
Turns out this is true; the coin is ~50% accurate. I wrote a monte-carlo simulation in Ruby to see who was right.
srand(8008156)
wins=0.0
trials=1000000
trials.times do
hour = rand(1..24)
flip = rand(1..2)
if flip == 1 and hour == 1 then
wins += 1.0
elsif flip != 1 and hour != 1 then
wins += 1.0
end
end
score = wins / trials
puts score