What does `random.randint()` do?

Am I the only one who thinks there’s a chunk of info missing like what does random.randint() does and how to use it?


Are you the only one who does not make adequate use of Search? No. You’re not alone. Many learners expect this to be a one-stop learning environment only to find that a lot of the process is dumped on their lap to learn for themselves.

There are numerous discussions in these forums on this very topic. Click the magnifying glass and type in randint and see how many come up.

Looking at the name, random given to the module, we can almost with certainty assume this will generate pseudo random numbers (between 0 and 1).

The name randint suggests this method will return an integer within some specified boundaries.

y = random.randint(1, 10) =>  { y | 1 <= y <= 10; y is int }

Note that this does not exclude the upper boundary. Both boundaries are inclusive. y above will be an integer from the above described inequality.