#This will return a list of 50 numbers selected from the range 0 to 999, without duplicates. import random random.sample(range(1000), 50)
import random dupl_list = [random.randint(1,50) for x in range(20)] print (dupl_list)