lundi 11 septembre 2017

I need to generate random numbers but each number must be different from the other

I got a function in another file, to recall that function i use:

app.put_number(row, column, number)

which is basically generating a matrix, but in the first column, for each row I need a random number from 1 to 20, and each number must be unique, I tried using random.randrange(). For example:

app.put_number(0, 0, random.randrange(1,21))
app.put_number(1, 0, random.randrange(1,21))

But sometimes it generates the same number and I need that each one of them to be different.

Plus I cant mess with the file with the actual function, I can only use if, else, while, for and app.put_number(row, column, number)




Aucun commentaire:

Enregistrer un commentaire