samedi 12 septembre 2020

fill an array with differents randoms integers Python

I need to fill an array with a randoms numbers in such a manner as the numbers will not be repeated .

The numbers are an integers values which varying from 0 to 9, and the array length is 4.

target = [random.randint(0,9) for i in range(4)]. What should i add as condition to prevent the numbers repetition ?

thank you !




Aucun commentaire:

Enregistrer un commentaire