Quantcast
Viewing latest article 10
Browse Latest Browse All 21

A Ruby Monte Carlo simulation of coin flips

A Ruby Monte Carlo simulation of coin flips

For some reason or another today I was curious about this question: If you flipped a coin ten times, what are the odds that the coin would come up heads ten times, or tails ten times)?

I'm sure there is a way to determine this statistically, but I don't know how to do that, so, being new to Ruby, I wrote a little Ruby simulation program — essentially a Monte Carlo simulation of the problem — to find the answer. (Pretty boring, I know, but hey, I was bored, interested in learning Ruby, and didn't feel like reading any more of The Stand right now.)


Viewing latest article 10
Browse Latest Browse All 21

Trending Articles