Game Development Reference
In-Depth Information
This function is included as a part of the class CDie on the Web site at
http://www.courseptr.com/downloads. We can easily add the class to any project.
T RIANGULAR D ISTRIBUTIONS
A triangular distribution is, in essence, a stripped-down form of a normal distrib-
ution. It shares some of the same characteristics, but without some of the additional
complexity. For example, a triangular distribution has a mean, median, and mode
just like its fancy cousin. Naturally, it also has a range in which its values lie.
Triangular distributions, however, have some special qualities that make them
useful in decision generation and simulation.
S IMPLIFIED N ORMAL D ISTRIBUTIONS
Triangular distributions can be used as a simple, slightly faster version of normal
distributions. To see why, let's go back to our repeated efforts at generating a num-
ber from 0 to 30. We showed two different methods that produced different curves:
3d11 and 5d7. If we had continued to increase the number of dice used, the curve
would have continued to get taller in the middle, with more of the population clus-
tered tightly around the mean. The curves in the curve (if you will pardon the
expression) became more pronounced as the population sample had to ramp up
from a large span of very small values to very large ones, top off, and then plunge
back toward 0% again.
However, if we were to reduce the number of dice from three to two (i.e.,
2d16), we would find that something very interesting occurs. There are no curves in
the curve whatsoever. In essence, we are left with two straight lines that meet at a
peak (Figure 11.13). Just as in the symmetrical normal distribution, the peak of an
unskewed triangular distribution is the mode, median, and mean.
Using a triangular distribution as a substitute for a normal distribution is often
an acceptable practice. While we may lose a little of the subtlety of the normal dis-
tribution's shape (specifically, the tapered tails), we gain quite a bit in the rapidity
of calculation. Obviously, using the above example of reducing a 3dx to a 2dx curve,
we are cutting the number of random number calls by 33%. In heavily used deci-
sion models, that can add up to a substantial savings of processor time.
 
 
Search WWH ::




Custom Search