Subject: | request: sample |
Originally from List::Util's queue, but it got no response:
https://rt.cpan.org/Public/Bug/Display.html?id=105275
"I frequently find myself in need of getting k random elements from a list of size n. To do this, I shuffle the list and take a slice of size k. But it would be more efficient when n is large to implement this as a truncated shuffle, so you can stop the shuffle algorithm after k steps. I would have proposed this for List::MoreUtils, but it might be better off in the same module as shuffle, especially if they can share the same XS implementation".