3 ms·
There's one pretty common exception that's "closed closed". random.randint(a, b) Return a random integer N such that a <= N <= b. Alias for randrange(a
by oittaa 4y ago
There's one pretty common exception that's "closed closed".
random.randint(a, b)
Return a random integer N such that a <= N <= b. Alias for randrange(a, b+1).
https://docs.python.org/3/library/random.html#random.randint https://docs.python.org/3/library/random.html#random.randint
But in reality nowadays you almost always want to use the newer, simpler and more secure "secrets" module.
- aftbit 4y agoTIL about the "secrets" module. I have typically used os.urandom() when I needed secure random.