Algorithms, Sampling.
list(range(n)) np.random.choice(data_stream, size=k, replace=False) # output is # [157105, 374554, 688694, 265381, 955415] This is great, but notice that it implies that we have O(n) storage to keep the entire data stream around. What if n >> k and we can’t keep it all in memory? It would be nice