Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Generated random numbers
703, 891, 244, 27, 341, 97, 971, 533, 255, 87, 24, 53, 693, 690, 160, 687, 791, 500, 285, 281, 324, 483, 751, 688, 87, 325, 105, 836, 38, 772, 545, 995, 649, 638, 325, 941, 746, 505, 418, 341, 747, 401, 25, 830, 361, 891, 950, 678, 725, 100
Range (inclusive) 1 to 1000
Distinct integers available (N) 1,000
Quantity generated 50

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\).

Advertisement
Diagram mapping a continuous unit interval U from 0 to 1 into N equal segments, each pointing to one integer outcome
A uniform value U in [0,1) is scaled and floored to land in one of N equal slots.
Flat number line showing an inclusive integer range from lo to hi with evenly spaced equal-height bars indicating equal probability
Each integer in the inclusive range lo..hi has an equal chance of being chosen.

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.

Last updated: