6 ms·
Reservoir sampling in a few lines of awk: https://github.com/taltman/scripts/blob/master/EDA/samp https://github.com/taltman/scripts/blob/master/EDA/samp It's
by taltman1 12y ago
Reservoir sampling in a few lines of awk:
https://github.com/taltman/scripts/blob/master/EDA/samp https://github.com/taltman/scripts/blob/master/EDA/samp
It's shorter than this ruby implementation, and includes copious documentation, file handling, and corner-case support.