dimanche 25 mars 2018

printing random list with the possibility of repeating items in Python [duplicate]

This question already has an answer here:

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