This is a simulation of simple random walk, including the Gambler's Ruin problem. (If you have trouble running the applet, see these notes.)

[Oops, your browser will not display java applets.]

This applet simulates a gambler who repeatedly bets $1, either forever (for random walk), or until he either loses by going broke or wins by doubling his initial fortune (for Gambler's Ruin). The probability of victory in the Gambler's Ruin game is known to be

[((1-p)/p)^(Init) - 1] / [((1-p)/p)^(Target) - 1]
(where p is the win probability of each individual bet, Init is the initial fortune, and Target is the target fortune). This is very small if p < 0.5 and I is large. [If p = 0.5 then this formula does not apply; in that case the probability is simply Init/Target.]

The applet accepts the following keyboard inputs. (You may need to "click" on the applet first.)

(This applet is a combination of my previous applets Gambler's Ruin and Longrun.)

Applet by Jeffrey S. Rosenthal (contact me).

[Return to my Applets Page / Home Page]