Reservoir sampling is a family of randomized algorithms for randomly choosing a sample of kitems from a list containing n items, where n is either a very large or unknown number. Typically n is large enough that the list doesn't fit into main memory.
http://www.geeksforgeeks.org/reservoir-sampling/
比如说题目里等于3的index有2,3,4. 所以我们要设计一个1/3的random算法。