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.
Tools and Utilities • Randomizers and Grouping
Generate a single random integer between a minimum and maximum value, with control over whether the endpoints are included or excluded.
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.
[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.
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.
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.