|
|
|
|
|
by unsupported
2809 days ago
|
|
Reservoir sampling or Algorithm R. It allows you to randomly choose a sample of k items (with equal probability) from an "infinite" stream of items.
At first it sounds impossible, but the solution and proof are extremely simple and elegant. |
|