randrange(start, stop)
only takes integer arguments. So how would I get a random number between two float values?
Use randint() Generate random integer Use a random. randint() function to get a random integer number from the inclusive range. For example, random. randint(0, 10) will return a random number from [0, 1, 2, 3, 4, 5, 6, 7, 8 ,9, 10].
Use random.uniform(a, b):
>>> random.uniform(1.5, 1.9) 1.8733202628557872
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With