Random Number Generator

Generate random numbers in a range with options for quantity, duplicates, and sorting.

By Konstantin Iakovlev · Updated September 2026 · Source: MDN Web Docs — Math.random()

Allow Duplicates
Sort

Generated Numbers

35, 51, 75, 18, 83

Count

5

Sum

262.00

Average

52.4

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.

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. 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. 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. 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. 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: September 2026

Frequently Asked Questions

How does a random number generator work?
Computer random number generators use mathematical algorithms (pseudorandom) or physical entropy sources (true random). For most purposes like games and simulations, pseudorandom generators provide sufficient randomness.
Are online random number generators truly random?
Most online generators use pseudorandom algorithms seeded with system entropy (time, mouse movements). They are sufficiently random for drawings, games, and simulations but not for cryptographic security.
How do you generate a random number between 1 and 100?
Set the minimum to 1 and maximum to 100 in the generator. Each number in the range has an equal probability of being selected. You can generate multiple numbers at once and choose whether to allow duplicates.