1

I was trying to generate 100000 random numbers in python, but at the moment of generating and saving them in a list the total of the added data is 78706, what should I modify to my code so that a total of 100000 random numbers are generated but there are no repeated numbers?

listaNumeros = []
for i in range(100000):
    numero = random.randint(0, 200000)
    if numero not in listaNumeros:
        listaNumeros.append(numero)
John James
  • 341
  • 3
  • 10

0 Answers0