Introduction
If you toss 100 fair coins at once, how many do you expect to be heads? How much variation would you expect? This program implements a Monte Carlo simulation of the statistical properties of the outcome of tosses of many coins. The probability that an individual coin is heads is p.
Algorithm
For each coin we generate a random number r uniformly in the interval [0, 1]. A coin is heads if r ≤ p. We simulate the toss of many coins and plot a histogram of the number of heads found for N tosses and compute the average number of heads and the standard deviation.
Questions
Java Classes
Updated 28 December 2009.