Ehrenfest's Urn javascript program, by Jeffrey Rosenthal, related to this book. Description at the bottom.

This program simulates an Ehrenfest's Urn Markov chain. At each iteration, a ball is chosen uniformly at random and moved to the other Urn. The CURRENT STATE is the number of balls in Urn #1. Keyboard shortcuts (you might need to click on the canvas first): '0-9' to change the simulation speed ('1' for one-step-at-a-time), or '+' or '-' to increase/decrease the total number of balls, or 'r' to restart.


This program is written by Jeffrey Rosenthal. See also my other JavaScript, my Stochastic Processes book, and my Java Applets.