3 ms·
Ha, that's how I originally wrote it, but I thought I should get rid of -n and END{} in an attempt to ward of the eww Perl comments. Sigh. But at least now I
by zengargoyle 7y ago
Ha, that's how I originally wrote it, but I thought I should get rid of -n and END{} in an attempt to ward of the eww Perl comments. Sigh.
But at least now I know that it's called Reservoir Sampling. I had wondered how to generalize it to wanting N lines.