Many events can't be predicted with total certainty. The best we can say is how likely they are to happen, using the idea of probability. For example when a coin is tossed, there are two possible outcomes:
- heads (H) or
- tails (T)
We say that the probability of the coin landing H is ½. And the probability of the coin landing T is ½. So the "chances" are fifty fifty that the coin lands heads or tails. Let's look at a different example. When a single die is thrown, there are six possible outcomes: 1, 2, 3, 4, 5, 6. The probability of any one of them is one in six. So the general rule is: The probability of an event happening equals the number of ways it can happen divided by the total number of outcomes.
Most importantly though, probability is just a guide. It does not tell us exactly what will happen. If we take the toss of coin 100 times, how many heads will come up? Probability says that heads have a ½ chance, so we can expect 50 heads. But when we actually try it we might get 48 heads, or 55 heads ... or anything really, but in most cases it will be a number near 50.
And then there are the other probabilities - how likely is it that your program crashes? Well... we think we identified a pattern here... And when that happens maybe it is just time to get a drink and call it a day.