I am try to create a generator that will look for n random integers in the range of 1 to m. The code below does exactly that however it will sometimes return a double of a number previously printed. Does anyone know how I can edit that? Another thing but it is more design-wise is, how can I order my print out so that the numbers are in order?
import random
def hwset(m,n):
i=0
for i in range(0,n):
print random.randrange(1,m+1,1)
Aucun commentaire:
Enregistrer un commentaire