Game Development Reference
In-Depth Information
original 3d6… just in a different location on the number line. Similarly, we could
generate numbers from 50 to 65 using the equation (3d6 + 47). Again, the only dif-
ference is the numbers generated. The functional performance of the numbers rel-
ative to each other is the same. The range is the same (with different endpoints), the
relative locations of the mean, median, and mode are the same, and the standard
deviation is identical to the pre-shifted version of the distribution. This is going to be
an important feature to remember as we move through the remainder of this topic.
The Distribution Checklist
By arranging the tools above, we can create a massive variety of normal probability
distributions to serve a variety of needs. Each feature of a normal distribution has
an associated factor that we can adjust to generate it. When constructing a distrib-
ution, we need to ask ourselves how we want these features to look and take the
related steps to accomplish that.
Range: What is the range of the distribution? That is, how wide is the “footprint�
going to be? This range will determine what the sum of our die rolls needs to be.
Standard Deviation: How clustered or spread out should our population be?
This will determine how many dice we will use to create the desired range. The
more dice we use, the more compact the population will be.
Skew: Will the distribution be symmetrical or skewed to the positive or nega-
tive direction? This will determine how many dice we will roll initially, keeping
only the number necessary to generate our desired standard deviation.
Position: This will determine the lower and upper bounds of the range. By
adding or subtracting a number from our die rolls, we slide the resulting distri-
bution left or right.
If we have in mind the sort of distribution that we would like to generate, we
only need to adjust these four parameters to craft our curve.
P UTTING I TIN C ODE
There is a function on the Web site at http://www.courseptr.com/downloads that
simplifies the generation of normal distributions. The declaration of this function is:
int RandomFromNormalDist (
int LowBound, // lower boundary
int HighBound, // upper boundary
 
Search WWH ::




Custom Search