lundi 6 avril 2020

do numbers in random.randrange have to be both integers? [duplicate]

I want to generate a random number between two numbers, but sometimes one of them or both will not be an integer (it will be a float). I understand that there can be so many possible numbers if one of them is a float and one of them is an integer, so I assigned a step as well (which is 1). This should produce a random number for me, but it gives me a value error that says

ValueError: non-integer arg 1 for randrange()

So I want to know if there is another random method that I can use so that it works with float values and integer values without giving me a value error.




Aucun commentaire:

Enregistrer un commentaire