Random Number Generator
Generate random numbers in a range with options for quantity, duplicates, and sorting.
By Konstantin Iakovlev · Updated October 2026 · Source: MDN Web Docs — Math.random() · Methodology
Use the Random Number Generator above to calculate your results. Enter your values and see instant results — all calculations run in your browser.
Disclaimer: This calculator is for informational purposes only. Results are estimates based on the information you provide and the assumptions described on this page.
You might also need
Binary / Hex / Octal Converter
Convert numbers between decimal, binary, octal, and hexadecimal.
Confidence Interval Calculator
Calculate confidence interval bounds and margin of error at 90%, 95%, or 99% confidence.
GCD & LCM Calculator
Find greatest common divisor and least common multiple with prime factorization.
How It Works
Generating random numbers within a chosen range supports a surprisingly wide spread of tasks: drawing statistical samples for research, picking raffle winners, or simulating something like a lottery draw. It is not a tool for passwords or anything else that has to stay secret, for the reason explained below.
Under the hood, the tool uses your browser's built-in Math.random() function, a pseudorandom generator whose algorithm the JavaScript standard leaves to each browser. Each draw is scaled to a whole number between your minimum and maximum, both included, with every value equally likely. You set the minimum and maximum, how many numbers you want (1 to 100), and whether repeats are allowed; with repeats off, a value that was already drawn is simply drawn again. Turning Sort on lists the results in ascending order. Math.random() is not cryptographically secure, so for passwords or keys use a generator built on the Web Crypto API's crypto.getRandomValues().
Because the output is pseudorandom, it comes from a deterministic process, yet for nearly every practical purpose it behaves like genuine randomness. Where people go wrong is expecting a handful of draws to mirror the distribution of the full range. Five numbers from 1 to 100 will often bunch together or leave big gaps; that is ordinary sampling variation rather than bias, so interpret short sequences with appropriate caution.
Example: Drawing Raffle Numbers for a Charity Event
- 1 A charity is holding a raffle and needs 100 different winning numbers between 1 and 500, listed in ascending order for easy checking.
- 2 Enter Minimum = 1, Maximum = 500 and Quantity = 100 (the most the generator makes at once), set Allow Duplicates = No and Sort = Yes, then press Generate Numbers.
- 3 The calculator lists 100 different numbers in ascending order, for example 3, 17, 45, 88, ..., 489, 497, together with their count, sum and average. Your list will be different every time.
- 4 Each of the 500 numbers had the same chance of being picked. Copy or screenshot the list as the record of the draw, because pressing Generate again or changing any input produces a new set.
Source: MDN Web Docs — Math.random() · Last updated: October 2026