Flip a coin. 💰

No, really. Go ahead and flip it.

Result: {result}

What did you get? Heads or tails? Well, it has to be one or the other. Whatever the result was, you probably were not surprised. Because whatever happened, there was exactly 50% chance of that happening.

In Scott Adam’s book God’s Debris, the old man asks:

“If you toss a coin a thousand times, how often will it come up heads?”

The answer is simple. We expect it to come up heads 50% of the time. But why? What does it mean to expect something? We certainly cannot guarantee that the coin will not come up heads 1000 times in a row.

What about flipping a coin ten times and getting heads every time? Do you think that would be surprising to you?


It would be.

At least, it should be. Because the chances of that happening are:

(1/2)10 = 0.0009765625 = 0.001%

But there is no reason you could ever be surprised by the result of any single coin toss. Only an experiment with multiple tosses can yield meaningful results.

The good news is, we can try this experiment right now. Since this is a virtual coin, it is fairly easy to flip it multiple times in a row.

Flipping Coins

Flipping Multiple Coins

In an ideal world, if you flip a coin 100 times, you would expect it to come up heads exactly half the time. That’s why we are using a function that returns heads 50% of the time and tails 50% of the time. As per the Law of large numbers, the difference between the number of heads and tails will keep decreasing as the number of tosses increase.

Let’s start keeping count, then.

Try flipping the coin, say, 100 times and see if the laws of probability hold up.

Result: ({count}) {result}

# of Heads: {headsCount}

# of Tails: {tailsCount}

You probably won’t get 50 heads and 50 tails. But the real-world results you will obtain will not be too far off from the ideal world.

As you see, it is easy to do this experiment multiple times pretty fast. Click or tap the button as many times as you want. If you’re on a computer, you can simply hold down the Enter key once you activate the button. On mobile, you have to keep tapping the button.

But, that’s not good enough.

Flipping Even More Coins

It’s not easy to tap a button hundreds or thousands of times. Let’s automate it so we can flip our coin a certain amount of times, instantly. All we need to do is to decide how many times.

Count: ({count})

# of Heads: {headsCount}

# of Tails: {tailsCount}

Turns out, the laws of probability are real and extremely reliable. This fact becomes more apparent as the number of repetitions approaches infinity. In other words, it may not be shocking to obtain 8 heads if you flip a coin only 10 times. However, it is fair to say that it would be extraordinary if you ever flip a coin 1000 times and obtain 800 heads.

Probability is useful. It is how the insurance companies make profit. But perhaps the most fascinating aspect of probability is that it is supposed to be fundamentally unreliable. Again, to quote the old man:

“Over time, everything that is possible happens. That is a fundamental quality of probability. If you flip a coin often enough, eventually it will come up heads a thousand times in a row.”

You can use probability while simultaneously realizing that it is inexplicable and fundamentally unreliable.

If you ever need to make a random choice, feel free to visit this post. You can also check out 🎲 Rolling Dice.

Over time, everything that is possible happens. 🙂