https://en.wikipedia.org/wiki/Reservoir_sampling
IMO it's a lot clearer if it's not in Perl ...
The pseudocode in Wikipedia also avoids division.
What isn’t?
https://en.wikipedia.org/wiki/Reservoir_sampling
IMO it's a lot clearer if it's not in Perl ...
The pseudocode in Wikipedia also avoids division.