ID EN
Random

sample

Python 3.11

Return a k length list of unique elements chosen from the population sequence. Used for random sampling without replacement.

Syntax

PYTHON
random.sample(population, k, *, counts=None)

See Also

hashable range() ValueError