Randomly samples n items the iterable by some weight function.
If you need to sample items with uniform weight, sample is more efficient.
This uses the Efraimidis–Spirakis algorithm.
type of the item
the iterable
the number of items to sample
the projection for the weight, defaults to always 1
random number generator
Randomly samples n items the iterable by some weight function.
If you need to sample items with uniform weight, sample is more efficient.
This uses the Efraimidis–Spirakis algorithm.