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 N coins at once and plot the histogram of the number of heads. We also compute the average number of heads, <H>, and the standard deviation averaged over many tosses of N coins.
Questions
Java Classes
Updated 3 June 2015.