4 ms·
The OP should have mentioned that it's this algorithm: https://en.wikipedia.org/wiki/Reservoir_sampling https://en.wikipedia.org/wiki/Reservoir_sampling IMO i
by chubot 7y ago
The OP should have mentioned that it's this algorithm:
https://en.wikipedia.org/wiki/Reservoir_sampling 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.
- ChristianGeek 7y agoIMO it’s a lot clearer if it’s not in Perl What isn’t?