This question already has an answer here:
- Get a random sample with replacement 4 answers
If I have a list of 10 items like ["item1", "item2", "item3", ..., "item10"]
random.sample(range(10), 4)
would return a list of 4 unique items within the range.
Is there another "random" method that returns a random list with the possibility of repeating items?
Thanks :)
Aucun commentaire:
Enregistrer un commentaire