lundi 18 mai 2020

Generate list of 3 numbers with a maximum of 2 duplicates

How can I generate 3 random numbers between 0 and 5 (inclusive) where it can have a maximum of 2 duplicates efficiently

So the lists I can generate can be:

a = [0, 4, 2]
b = [5, 1, 4]
c = [5, 5, 3]
d = [2, 3, 2]

It cannot generate a list like:

a = [4, 4, 4]



Aucun commentaire:

Enregistrer un commentaire