Random Number Generator
Generate random numbers in any range. Support for unique-only draws, sorting, and instant statistics — mean, median, min, max and sum. All processing runs in your browser.
How the Random Number Generator Works
Our random number generator runs entirely in your browser. No numbers, ranges, or generated data are ever transmitted to a server. This makes it safe for classroom exercises, classroom lottery draws, dice simulations, raffles, statistics homework, and quick prototyping where you want to keep your inputs private.
The tool supports the full JavaScript safe-integer range (from -9,007,199,254,740,991 up to 9,007,199,254,740,991), though for performance we cap a single draw at 100,000 numbers. When the unique only option is on, the generator performs a uniform shuffle over the requested range — every value in the range has an equal probability of being selected, with no repeats.
Understanding the Statistics
Every time you generate numbers, the tool computes five summary statistics over the draw:
- Mean (average) — the sum of all values divided by the count.
- Median — the middle value of the sorted results. For an even count, it is the average of the two middle values.
- Min / Max — the smallest and largest values drawn.
- Sum — the total of all generated numbers.
These statistics update instantly as you regenerate. For large samples (thousands of numbers) the distribution of values should hover close to the midpoint of your range — a quick visual check that randomness is working as expected.
Crypto-Grade vs. Fast PRNG
By default this generator uses crypto.getRandomValues(), the Web Crypto API's cryptographically strong pseudo-random number generator (CSPRNG). This is the right choice when the output must be unpredictable — for example raffle draws, token samples, or any context where someone might try to predict the next number.
If you uncheck Use crypto-grade randomness, the tool falls back to Math.random(), which is much faster but should not be used for security-sensitive work. For most casual use cases (dice rolls, game prototyping, sampling) Math.random() is perfectly adequate.
FAQ
Are the generated numbers truly random?
crypto.getRandomValues(), a cryptographically strong pseudo-random generator seeded by the operating system. It is unpredictable enough for raffles, lotteries, and security-sensitive sampling.