Random number generator
Generate a random integer within the minimum and maximum range you choose, with the distribution you prefer (normal by default, uniform, triangular or exponential), using the browser's cryptographic API.
With the uniform distribution, every number in the range has exactly the same probability. With normal, triangular or exponential, the parameters are derived from the range and values falling outside it are discarded and redrawn.
Use cases
- Drawing a winner from a range of entry numbers.
- Picking a random page for a quality review.
- Generating test data.
How it works
- 1
Set the range
Type the minimum and maximum value.
- 2
Pick the distribution
Normal concentrates results around the middle of the range; uniform gives every number the same probability.
- 3
Generate
Click Generate to get a random number within the range.
Technical details
- Both ends are included: between 1 and 6 you can get 1 as well as 6. If the minimum is larger than the maximum, they're swapped.
- With min and max it only generates whole numbers; if you type decimals, the bounds are rounded.
- For normal and exponential you can switch "Define by" to parameters: mean and standard deviation (normal) or mean (exponential, which starts at 0 and whose variance is the mean squared). In that mode there are no range limits, values are not clipped and you can choose 0 to 10 decimals.
- Very wide ranges are supported, up to about 9 quadrillion values.
- Normal: mean at the middle of the range and standard deviation of one sixth of its width, so 99.7% of values fall inside without clipping the bell.
- Triangular: probability rises linearly to the middle and falls toward the ends. Exponential: low values are most likely, with a mean around one fifth of the width above the minimum.
- Randomness comes from crypto.getRandomValues(), the browser's cryptographic source; for uniform, with rejection sampling so no outcome is favored.
Frequently asked questions
Can it repeat the same number across generations?
Yes, each generation is independent; previously drawn numbers are not excluded.
Related tools
- Border Radius GeneratorCreates CSS border-radius with preview.
- Box Shadow GeneratorCreates CSS shadows with a live preview.
- Code 128 GeneratorGenerates a Code 128 barcode.
- Code 39 GeneratorGenerates a Code 39 barcode.
- Coin FlipFlips a virtual coin: heads or tails.
- CSS Gradient GeneratorCreates CSS gradients with preview.