What this tool does
The Integer Uniform Random Number Generator produces a list of random whole numbers drawn uniformly from an inclusive range you define. "Uniform" means every integer between your lower and upper bound is equally likely to appear. You decide how many numbers to generate and whether the same value may appear more than once. It is handy for lottery picks, dice and game rolls, sampling rows from a dataset, assigning IDs, A/B test bucketing, and classroom statistics demonstrations.
How to use it
Enter the lower bound in "Range from" and the upper bound in "to" (any integer from 1 to 100000). Set "Count / Quantity" to how many numbers you want (1 to 100). Choose "Allow" to permit repeats (sampling with replacement) or "Do not allow" for all-distinct results (sampling without replacement). If you accidentally enter the bounds in the wrong order, the tool automatically swaps them.
The formula explained
The range [lo, hi] contains \(N = \text{hi} - \text{lo} + 1\) distinct integers. A single draw is $$r = \text{lo} + \left\lfloor U \times N \right\rfloor,$$ where \(U\) is a uniform random real in \([0, 1)\). Multiplying \(U\) by \(N\) and flooring gives an integer from \(0\) to \(N-1\), which is then shifted up by \(\text{lo}\). This guarantees each candidate value has probability exactly \(1/N\). With duplicates allowed, the tool repeats this draw independently for each requested value. Without duplicates, it keeps drawing and discards any value already chosen until it has collected the requested count of unique numbers, which requires count to be no greater than \(N\).
Worked example
Range from 1 to 6, count 5, duplicates allowed: each draw is $$r = 1 + \left\lfloor U \times 6 \right\rfloor,$$ behaving like a six-sided die. A possible result is 4, 1, 6, 4, 2 (the 4 repeats, which is allowed). With duplicates not allowed you would get five distinct values such as 3, 5, 1, 6, 2. Requesting 7 distinct values from 1 to 6 is impossible because only six integers exist.
FAQ
Why do I get different results every time? The generator is non-deterministic; each run draws fresh random values, so output varies by design.
Can the lowest and highest be equal? Yes. If they match, \(N = 1\) and the only possible value is that number.
What happens if I ask for more unique numbers than exist? In "Do not allow" mode the tool reports an error because there are not enough distinct integers to satisfy the request.