samedi 2 janvier 2016

Random numbers with duplication [on hold]

I need random values, and I don't care if I have duplicates or not.

I did try random.randrange, but it won't generate duplicates. Is there a simple way to do so, or do I have to run the random function with the same seed, multiple times, which should generate the same sequence

list = [random.randrange(1,100,1) for _ in range(20)]

Out of 10 run, this never generated a single couple of duplicate values. Before downvoting "because it should work"; it does not work for me.




Aucun commentaire:

Enregistrer un commentaire