Thank you for your replies!
Shuffling an array and then picking the first k elements would do what I want, but that's still linear in n. The "sample" module seems to be efficient, though.
In reply to Re: Pick k numbers at random
by Chuma
in thread Pick k numbers at random
by Chuma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |