Random walk illustrated with D3
mixedbit.org
mixedbit.org
My only suggestion is that .data([color_idx]) would be more idiomatic (I think) if it were .datum(color_idx)
The apriori expected outcome of a random walk is zero. The expected outcome of a random walk from a given position is the position itself. So no, 'any lucky series' will not 'always eventually be reversed'. I'm afraid that's not how probability works.
But you still shouldn't play roulette.
In real life people usually don't play an infinite number of times, but the more you play, the better the theory approximates your final outcome. After very large number of games, you will very likely encounter a bad luck series.
This is a bit counter intuitive, because according to the theory, there is a difference between a person that enters a fair game with 10$ and a person that enters with 1$ and wins 9$ in the first 9 games. The first person is expected to finish with 10$, the second with 1$, even though both have the same amount of money at some point. But laws that involve infinity are often counter intuitive.
You understand it incorrectly.
>This is a bit counter intuitive, because according to the theory, there is a difference between a person that enters a fair game with 10$ and a person that enters with 1$ and wins 9$ in the first 9 games. The first person is expected to finish with 10$, the second with 1$, even though both have the same amount of money at some point. But laws that involve infinity are often counter intuitive.
That is exactly the example I would give of why your understanding is flawed. This is not 'counter-intuitive', it is a clear contradiction of basic logic. You are making a fairly common error in confusing a priori probability with conditional probability: http://en.wikipedia.org/wiki/Gamblers_fallacy. A standard phrase used by gamblers to refer to this truth is that "the dice have no memory."
If you start a random walk from Chicago, you are expected to end up in Chicago. If you start a random walk from New York, you are expected then to end up in New York. If you, later on that same walk, notice that you are currently in Chicago, you can start expecting yourself to end up in Chicago, despite that your random walk started in New York: you have observed the actual events (collapsed the waveform), and now you have just taken a walk.
This is the core of the misconception: "The first person is expected to finish with 10$, the second with 1$, even though both have the same amount of money at some point." The first person was expected to finish with 10$, and the second was expected to finish with 1$, but after the second player has won 9 games, he is then expected to finish with 10$, and anyone standing around watching who still has faith in their earlier expectation is uninformed.
http://stackoverflow.com/questions/7180099/including-js-from...
At least in IE 10, it would work if it wasn't for this.