There are many ways to define probability, based on a given situation and the type of game or application you are building. The most commonly used definition of probability is to consider the probability of an event as the frequency with which the event occurs when we repeat the observation an infinite amount of times. In other words, if we throw a die 100 times, we expect to see a six, on average, 1/6th of the times, and we should get closer and closer to 1/6th with 1,000/10,000/one million throws.
We can write the probability for an event A to occur as P(A). To calculate P(A) we need to know all the possible outcomes (N) for the observation and the total number of times in which the desired event occurs (n).
So, the probability of an event A can be calculated as the following:
If P(A) is the probability of the event A to successfully occur, then the...