vendredi 5 mai 2017

How to use random.sample() that it always generate number

The goal is to give start and end limit and the # of numbers to generate. For instance I want to generate 100 random numbers between 1-100.

How do I make sure that I don't get ValueError exception?

The code I am using is:

nums = random.sample(range(1000, 2000), 1999)




Aucun commentaire:

Enregistrer un commentaire