SHOW:
|
|
- or go back to the newest paste.
1 | n = 60000; q = 0.495; NSim = 10^5; sigma = Sqrt[4 q (1 - q)]; | |
2 | sims = Table[Total[RandomChoice[{q, 1 - q} -> {1, -1}, n]], {NSim}]; | |
3 | distr = HistogramDistribution[sims]; | |
4 | Show[ | |
5 | DiscretePlot[PDF[distr, x], {x, -1200, 600}], | |
6 | Plot[PDF[NormalDistribution[-600, Sqrt[n]*sigma], x], {x, -1200, | |
7 | 600}] | |
8 | - | ] |
8 | + | ] |
9 | ||
10 | Max[Table[Total[RandomChoice[{q, 1 - q} -> {1, -1}, n]], {10^5}]] |