Download the Python script here: htrand.rar
What this calculates is explained at this page.
Usage:
This is a Python script, usage is straightforward. You need to have Python installed on your system. You may then launch your console, go to the directory of the htrand.py script and launch it as follows:
python htrand.py x y z
You need to substitute x, y and z with 1 for head and and 0 for tail(it makes no difference they are opposite sides). So to calculate the average probability for HTT pattern you need to write:
python htrand.py 1 0 0
Wait a bit and it will tell you how many tosses you need to take on average(after the initial two tosses, calculated by averaging 100000 trials) to reach that particular pattern. Easy.

