Coin Flips

Today in biology class, when the professor was talking about genetic drift, I learned an interesting fact about probability. If you flip a coin a small number of times, the percentage of times that the coin turns up heads tends not to be near 50%. For example, if you flip a coin ten times, there's a significant chance that the frequency of head will be 3/10, or 6/10, or 8/10. However, if you flip a coin 10000 times, the frequency of heads is almost certainly going to be very close to 50%.

This program flips coins. It starts by flipping one coin and recording the percentage of heads. Then two, then three, and so on, all the way up to the maximum value that you input below. Then it graphs them. You can see that as the number of coins flipped increases, the frequency converges to 50%.

This text will be shown if your browser doesn't support the canvas element.