reimplement count O(n)
implemented reservoir sampling O(n)