-Python 3.8.5 ・ Osx10.15.6
When I used a random number for the first time in Python
, there was a similar notation, so I wrote the difference.
random.randrange (a, b)
returns an integer from "a" to "b-1".
If there is one argument, an integer with an argument minus 1 is returned from "0".
random.randint (a, b)
returns an integer from "a" to "b".
The difference between including or not including the last number!
random.randrange (a, b)
does not include the last value, so combine it with len (array)
Convenient for iterating arrays!
About the random function ・ Https://www.lifewithpython.com/2013/04/random.html
Recommended Posts