How To Generate Random Numbers Calculator
A random number generator turns a range into a draw. The interesting part is not the numbers themselves but the statistics of the set you get back.
Generated numbers
34, 2, 37, 1, 68
- Minimum
- 1
- Maximum
- 68
- Median
- 34
- Mean
- 28.4
- Sum
- 142
- Distinct values
- 5
The first screen comes from a fixed seed, so every build is identical. "Draw again" reseeds it. Lottery draws and shuffles need a dedicated tool: web random numbers are not unpredictable enough.
The formula this calculator uses
value = floor(min + u x (max - min)), where u is a uniform draw in [0, 1)
- u
- A uniform random value between 0 and 1
- min
- The smallest value the draw may return
- max
- The largest value the draw may return
How to check the result by hand
- 1
Set the range
Enter the smallest and largest values the draw may return. The width of the range is the maximum minus the minimum, and that width is what the uniform fraction gets scaled by.
- 2
Choose how many values
Pick the count. Small counts highlight the scatter around the midpoint of the range, while larger counts show the mean settling towards it.
- 3
Decide on decimals and repeats
Allowing decimals gives continuous values, and forbidding repeats filters out anything already drawn. Forbidding repeats on a narrow range is what makes a draw slow or impossible.
- 4
Draw and read the statistics
The numbers appear in the order they were drawn, together with the smallest, the largest, the median, the mean, the total and how many distinct values came out.
- 5
Reseed for a fresh draw
Pressing the draw button advances the seed by one step, which produces a completely different sequence from the same range and count.
For worked examples, common mistakes and the limits of this formula, read the full How To Generate Random Numbers page.