Skip to main content
Random Number

Random Number Generator

Generate random numbers within any range. Single numbers, lists, or dice rolls.

Press Generate to get a random number

How It Works

This random number generator (RNG) produces unpredictable numbers on demand. It has three modes: a single random number between any minimum and maximum, a list of many numbers at once (with an option to make every value unique, like a draw without replacement), and a dice roller for d4 through d100. Every result is added to a running history so you can keep a record. It is handy for fair decisions and lucky draws, picking raffle or giveaway winners, choosing a random roll number from a class, shuffling a playlist or quiz order, generating test data, and rolling dice for board and tabletop games when no physical dice are at hand.

How the range works

In single and list mode you set a minimum and a maximum, and every number returned falls within that range inclusive of both ends. So a range of 1 to 6 can return 1, 2, 3, 4, 5 or 6, and a range of 1 to 100 can return 1 or 100. The count of possible outcomes is (max โˆ’ min + 1) โ€” that "+1" is why both endpoints are reachable. The minimum must not be greater than the maximum; if it is, generation is disabled until you fix it. Dice mode is just a preset range: a dN die produces a whole number from 1 to N.

Unique numbers vs repeats

By default, numbers in a list are drawn with replacement, so the same value can appear more than once โ€” exactly like rolling one die several times. Switch on unique values only and the generator draws without replacement, so no number repeats. This is what you want for a lottery-style pick or for shuffling a set of items into a random order. Because each value can only be used once, a unique list can never be longer than the range itself: you cannot draw 50 unique numbers from the range 1 to 10. To make a unique list, the tool builds the full pool of numbers in range and shuffles it with the Fisher-Yates algorithm, which gives every possible ordering an equal chance.

How the randomness is generated

The numbers come from JavaScript's Math.random(), a pseudo-random number generator (PRNG). A PRNG starts from an internal seed and runs a deterministic formula that produces a stream of values spread evenly (uniformly) between 0 and 1. The output passes statistical tests for randomness and looks random for any practical purpose, but it is not cryptographically secure โ€” given enough output the sequence can in principle be predicted. That is perfectly fine for games, simulations, sampling, and casual draws. It is not suitable for security-sensitive uses such as passwords, OTPs, lottery prize draws with money at stake, or cryptographic keys; for those you need a cryptographically secure generator like the browser's crypto.getRandomValues().

Worked example: a lucky draw

Imagine 80 people enter a giveaway, each assigned a number from 1 to 80, and you want to pick 3 distinct winners. Choose list mode, set the minimum to 1 and the maximum to 80, set the count to 3, and turn on unique values. The generator might return, say, 14, 57 and 62 โ€” three different entrants, each picked with the same 1-in-80 chance, and none repeated. If you only need a single winner, single mode with the same 1 to 80 range does the job in one tap. To make a draw feel fair and transparent, announce the range and count before you generate.

Tips and common mistakes

A frequent slip is expecting the maximum to be excluded โ€” here it is included, so a 1-to-6 range really can show a 6. Another is forgetting that "unique" caps the list length at the range size. If you want results that you (or others) can reproduce later for an audit, this kind of in-browser generator will not help, because each run is fresh and nothing is seeded by you; record the outputs from the history panel instead. Finally, do not read patterns into short runs: genuine randomness happily produces streaks and repeats, so getting three 6s in a row is unusual but not "broken".

Frequently Asked Questions

Math.random() is a pseudo-random number generator (PRNG) โ€” it produces numbers that appear random but are generated by a deterministic algorithm. It is sufficient for games and simulations. For cryptographic security (passwords, tokens), use crypto.getRandomValues() instead.

Part of Math Tools & Converters โ€” compare every related calculator in one place.