This program simulates the game of heads or tails where you specify the "tosses per game" and the "number of games." The program then plots the distribution for the times that you are in the lead.


The source.