Loading…

Random Integer in Range

Tools and Utilities • Randomizers and Grouping

View all topics

Random Integer in Range

Generate a single random integer between a minimum and maximum value, with control over whether the endpoints are included or excluded.

The interval type decides which edge values are allowed to appear as results.

Ready

Rate this calculator

0.0 /5 (0 ratings)
Be the first to rate.
Your rating
You can update your rating any time.

Frequently Asked Questions

What does random integer in range mean?

It means picking one whole number at random from all integers that lie between your minimum and maximum, subject to whether the endpoints are allowed. Each integer in the allowed set is a possible outcome.

What is the difference between [min, max] and (min, max) in the interval type?

[min, max] includes both endpoints, so min and max are allowed results. (min, max) excludes both endpoints, so only integers strictly between min and max can be returned.

Why does the calculator say there are no integers in the chosen interval?

This happens when your interval rules remove all possible integers (for example, min and max are consecutive but you exclude both ends). Adjust the endpoints or choose a different interval type so at least one integer remains.

How many different integers can be generated for each interval type?

For [min, max], count = max - min + 1. For (min, max] or [min, max), count = max - min. For (min, max), count = max - min - 1, and it must be at least 1 to generate a result.