Apex › Distributed systems

Reservoir sampling

Pick k items uniformly from a stream you can't store and whose length you don't know, in one pass. Step the stream through a fixed reservoir, then see 3000 runs prove every item is selected about k/n of the time.

More in Distributed systems