Choose a random sample of 10 values from an unbounded stream. Red marks denote values currently in the sample.
From Wikipedia:
The algorithm creates a "reservoir" array of size k and populates it with the first k items of S. It then iterates through the remaining elements of S until S is exhausted. At the ith element of S, the algorithm generates a random number j between 1 and i. If j is less than k, the jth element of the reservoir array is replaced