Sampling From a Stream of an Indefinite Length
How do we ensure that the probability of an item in a stream being selected is no different than those of the others? Reservoir Sampling is the algorithm that comes to our rescue. In this post I lazily showed why Reservoir Sampling works.