As the histogram is built, one sample at a time, it develops as a roughly rectangular shaped distribution, but rather jagged, rather than showing the smooth straight horizontal line found in textbook illustrations of the Uniform.
This is the natural result of random sampling. Real random samples are irregular, and don't follow a consistent (deterministic) rule, and don't repeat exactly sample after sample.
So the histogram will have various peaks and valleys. It will be mostly flat overall. But it won't be very smooth, and won't be the same in subsequent runs. The jagged histogram from this simulation has many ups and downs. I.e. there are many local peaks and valleys - about a dozen of each in a typical run for this 50 category histogram. This is what we expect from random sampling from the Uniform Distribution.
The histogram has 50 columns. After the simulation is finished, the script puts the "height" of each column (the number of samples) in the text box named "cheights" which is below the simulation display.
This box will be empty when the simulation is running, so the appearance of the heights means that the simulation is finished.
Here is a list of the 50 column heights from one run of the simulation. It gives the numbers of samples observed for each of the 50 sections of the histogram which covers the range of the distribution. A list like this is shown in the "cheights" text box.
15, 16, 15, 25, 22, 25, 21, 19, 18, 24, 28, 20, 21, 20, 17, 21, 24, 16, 17, 18, 17, 12, 20, 20, 26, 21, 23, 16, 21, 21, 22, 25, 21, 20, 19, 23, 18, 25, 31, 30, 23, 24, 21, 16, 20, 18, 19, 17, 20, 22
Here is another list of 50.
22, 16, 14, 21, 15, 25, 21, 24, 17, 28, 18, 19, 25, 21, 14, 16, 28, 21, 15, 22, 19, 20, 23, 20, 21, 28, 25, 23, 21, 21, 21, 31, 22, 21, 26, 17, 16, 21, 21, 22, 19, 23, 22, 21, 23, 20, 29, 18, 21, 20
Yet another list of 50:
21, 17, 22, 16, 23, 21, 20, 21, 13, 31, 20, 18, 19, 21, 24, 18, 24, 18, 23, 16, 15, 20, 22, 21, 16, 12, 16, 23, 16, 18, 17, 27, 21, 13, 11, 15, 15, 14, 16, 14, 28, 15, 13, 19, 15, 21, 19, 17, 27, 20
Return to Uniform Sampling Exercise
Copyright © 2006 by Henry E. Schaffer
I appreciate the support of the NCSU Genetics Dept. and the
Information Technology Division