Game Development Reference
In-Depth Information
There are some other important plots that can be generated based on a given probability
function. For example, the cumulative distribution function is the integral (the area under the
curve) of the probability function. The cumulative distribution function indicates the probability
that a variable value will be less than or equal to a given value. The cumulative distribution
function corresponding to Figure 15-1 is shown in Figure 15-2. The probability at x = 11 is 0.841,
meaning that based on the probability function shown in Figure 15-1 there is an 84.1% chance
the value of x will be less than or equal to 11. The cumulative probability of the mean value is
always 0.5. In this example, the mean value is 10, and that is the value in Figure 15-2 at which
the cumulative probability is 0.5.
Figure 15-2. A typical cumulative distribution function
Here is a typical game programming probability question: in a horse racing simulation
where the speed of the horses is given by a probability distribution function, what will be the
speed of a randomly selected horse? The probability or cumulative distribution functions won't
provide the answer to this type of question. To obtain information of this nature, we need to
look at the inverse cumulative distribution function , also known as the percent point function or
PPF. The inverse cumulative distribution function for the curve shown in Figure 15-2 is shown
in Figure 15-3. The probability is now on the horizontal axis, and the corresponding value of x ,
now the dependent variable, is on the vertical axis.
Here is the process for how to use the inverse cumulative distribution function to solve the
horse speed problem mentioned previously. Assume that Figure 15-3 represents the inverse
cumulative distribution function for the speed of a horse in m/s . A random number generator
can be used to produce a number between 0 and 1, representing a probability value. The speed
of a randomly selected horse can be found from the probability value and the curve shown in
Figure 15-3.
 
Search WWH ::




Custom Search