I simulate a simple experiment, a coin flip. What I do is accumulate the mean of the results up to the i-th experiment. What I can't figure out is why the computed means do not asymptotically approach 1/2. What did I do wrong? The code:
n = 10^4;
c = Table[{i, RandomInteger[]}, {i, 1, n}];
s = 0;
m = {};
For[i = 1, i <= n, i++,
s += c[[i, 2]];
AppendTo[m, {i, N[s/i]}];
]

0.5for me but your method is very inefficient. What are you seeing and why do you expect something else? – Mr.Wizard Jan 19 '13 at 10:32