As explained here, the average distance or 'travel' of a random walk with $N$ coin tosses approaches: $$\sqrt{\dfrac{2N}{\pi}}$$
What a beautiful result - who would've thought $\pi$ was involved! However, what would be the formula to use for an arbitrary paytable?
For example, a coin toss has the paytable:
- 0.5 : -1
- 0.5 : 1
...so a 50% chance of both winning or losing a point. After 10,000 coin tosses, the travel on average will be $\sqrt{10000\cdot2/{\pi}} \approx 79.788$.
However a dice roll where you need to land a six to win could have the paytable:
- 0.8333.. : -1
- 0.1666.. : 5
After 10,000 dice rolls, the travel on average will be about 178. However, I only know that because I used simulation to brute force the result - I don't know the formula.
More generally, a paytable could have multiple entries where all the probabilities add up to one:
- probability1 : payout1
- probability2 : payout2
- probability3 : payout3
- ...
- ...
- probabilityN : payoutN
Note that the total of the payouts may not necessarily be zero. It could be weighted to produce an unfair game. For example:
- 0.75 : -1
- 0.1 : 0.5
- 0.15 : 4.5
That's an average payout of $-0.025$ with a variance of $3.811875$, and using simulation, I get $\approx 268.8$ 'travel' from 10000 runs. But how would I find this out directly?
In other words, how would you find the average 'travel' of such a generalized paytable without resorting to simulation? As a side question, would this figure also be a better indication of risk for such a 'game' compared to the standard deviation of the paytable as defined here?
Here's the code I used for the simulation: http://pastebin.com/985eDTFh
It's written in C#, but is otherwise very well self-contained. Most of it is a fast random class, but you can use the default Random class if you prefer. Also, if you're not using C#, don't worry too much about converting the convertCSVtoPayoutTable() function as you can hard code the probability and payout arrays yourself if you prefer.