weighted reservoir sampling. Retrieves M samples from a population of N items in time O(N) and space O(M).
Requirements: