in reply to Pick k numbers at random
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pick k numbers at random
by haukex (Archbishop) on Nov 12, 2019 at 15:20 UTC | |
by Discipulus (Canon) on Nov 12, 2019 at 20:48 UTC | |
by AnomalousMonk (Archbishop) on Nov 12, 2019 at 23:16 UTC | |
by syphilis (Archbishop) on Nov 13, 2019 at 01:06 UTC | |
by Discipulus (Canon) on Nov 13, 2019 at 08:52 UTC | |
by choroba (Cardinal) on Nov 13, 2019 at 15:55 UTC | |
by ikegami (Patriarch) on Nov 14, 2019 at 18:19 UTC | |
|
Re^2: Pick k numbers at random
by NERDVANA (Priest) on Nov 13, 2019 at 09:39 UTC |