Random number generator
- Runs in your browser
- No signup
- Formula shown below
- Reviewed
A random number generator draws integers uniformly from a range using X = min + ⌊U × (max − min + 1)⌋, where U is a uniform random value from the browser cryptographic random source. Drawing from 1 to 100 gives every value an equal 1% probability. Selecting six unique numbers from 1 to 49 samples without replacement, so no value repeats.
Result
Random number between 1 and 100
63
X = min + ⌊U × (max − min + 1)⌋, U uniform on [0, 1)
- Range size
- 100 values
- Probability per value
- 1.0000%
A random number drawn uniformly from the 100 integers between 1 and 100: 63. Every value in the range has an equal 1.00% chance of being selected on each draw.
Drawn from the Web Crypto CSPRNG in your browser. Suitable for prize draws, sampling and simulation; results are never sent to a server, so nobody — including this site — can see or reproduce them.
How to use the random number generator
- 01
Set the range
Enter the minimum and maximum. Both ends are included, so 1 to 6 models a standard die and produces six possible outcomes.
- 02
Choose how many numbers
Enter the count. Up to 500 numbers can be drawn in a single request.
- 03
Decide on repeats
Enable no-repeats to sample without replacement, which is what a raffle, a lottery draw or a random assignment requires.
- 04
Sort if it helps
Enable sorting to present the drawn numbers in ascending order. Sorting affects presentation only, never the draw itself.
- 05
Draw again
Press regenerate for a new independent draw. Nothing about a previous draw influences the next one.
The formula
X = min + ⌊U × (max − min + 1)⌋, U uniform on [0, 1)
- X
- The generated integer.
- min
- The lowest value in the range, inclusive.
- max
- The highest value in the range, inclusive.
- U
- A uniform random value in [0, 1) from the Web Crypto CSPRNG.
- ⌊ ⌋
- The floor function, discarding the fractional part.
Both endpoints are inclusive, so the range from 1 to 6 contains exactly six outcomes. Selecting unique values uses sampling without replacement; when the count equals the range size, a Fisher-Yates shuffle produces a full permutation, which is the correct way to randomise an ordered list.
Worked example
- Minimum
- 1
- Maximum
- 100
- How many
- 1
- No repeats
- Off
- Result
- One integer between 1 and 100
The range spans max − min + 1 = 100 values, so every integer from 1 to 100 has probability 1 ÷ 100 = 1.00%. The generator requests a 32-bit unsigned value from the Web Crypto API, divides it by 2³² to obtain a uniform value U in [0, 1), multiplies by 100, takes the floor, and adds the minimum. Requesting six unique values from 1 to 49 instead gives each of the 13,983,816 possible combinations an equal chance.
Frequently asked questions
Are these numbers genuinely random?
Every value is drawn from the Web Crypto API's cryptographically secure pseudorandom number generator, seeded by operating-system entropy from hardware sources. Output is computationally indistinguishable from true randomness and is suitable for prize draws, sampling and key material. It is not a hardware quantum source, but no statistical test can distinguish the two.
What is the difference between a CSPRNG and Math.random?
Math.random uses a fast non-cryptographic algorithm whose internal state can be recovered from a modest number of observed outputs, making all future values predictable. A cryptographically secure generator is built so that recovering state or predicting future output is computationally infeasible. Anything with a prize, a stake, or a secret attached requires the secure generator.
How do you pick a random winner fairly?
Assign each entry a sequential number from 1 to N, then draw one integer in that range. For multiple winners, enable no-repeats so the same entry cannot be drawn twice. Recording the entry list before drawing, and drawing once rather than repeatedly, is what makes the process auditable and defensible.
What does sampling without replacement mean?
Sampling without replacement removes each drawn value from the pool, so no value can appear twice — the model for a lottery draw or a raffle. Sampling with replacement returns each value to the pool, so repeats are possible, which is the model for rolling a die repeatedly. The two produce measurably different probability distributions.
Can this generator be used for a lottery or a giveaway?
Informal draws, classroom selection and giveaway winner picking are all appropriate uses. Regulated gambling and formal prize promotions are subject to jurisdiction-specific rules that often require certified randomness sources and independent audit. Check the applicable regulator's requirements before relying on any browser tool for a legally binding draw.
Why do random numbers sometimes repeat or cluster?
Clustering is what genuine randomness looks like. Sequences that alternate evenly are the ones that are not random. Drawing ten numbers from 1 to 100 gives roughly a 37% chance of at least one duplicate — the birthday problem — and streaks of similar values are expected. Enable no-repeats when duplicates are unwanted.
Sources
- Web Crypto API — getRandomValues specification — World Wide Web Consortium
- NIST SP 800-90A — random bit generation — US National Institute of Standards and Technology
- A statistical test suite for random number generators — US National Institute of Standards and Technology
Last reviewed: · Formula and sources verified by Syed Aqeel Ahmad Gillani. See the methodology for how every calculation is derived.