Random Generate Subset with Length K By Reservoir Sampling

| I described Reservoir Sampling algorithm to tackle the problem to generate K (K <= N) items out of N total items uniformly at random while only storing at most K of them. The analysis and proof of the probability is also given and a special case is pointed out which needs to be carefully taken care of.
Read More