# Random Number Generator - Any Range, No Repeats, Decimals, No Bias

Page: https://hirantha.me/tools/random-number-generator
Part of: Hirantha Sandaruwan Lakshan free tools (https://hirantha.me/tools)
Updated: 2026-10-15

Pick random whole numbers or decimals in any range, with or without repeats, drawn fairly from your browser's secure random number generator.

This is a free tool that runs in the browser: open the page to use it. File tools process files on the visitor's own device; files are never uploaded or stored. No account, sign-up, payment or watermark.

Pick a random number between any two values, from 1 to 10 up to plus or minus 9,007,199,254,740,992. Ask for one number or up to 10,000, allow repeats or make every number different, sort the list, add decimal places and copy the result with the separator you want. The numbers come from your browser's secure random number generator and are drawn without modulo bias, so every number in the range has exactly the same chance. Nothing is sent anywhere.

The numbers come from crypto.getRandomValues, the random number generator built into your browser. MDN explains that browsers do not use a truly random source for it: they use a pseudo-random number generator seeded with a value with enough entropy, one that is suitable for cryptographic purposes. A true random generator measures a physical process such as electrical noise. A pseudo-random generator is a formula that stretches a small random seed into a long stream. A cryptographic one is designed so that its output cannot be told apart from true randomness by any practical test. MDN also warns that Math.random does not provide cryptographically secure numbers, and this tool never uses it.

A random 32-bit value is a whole number from 0 to 4,294,967,295. Squeezing it into a range by taking the remainder is slightly unfair unless the range divides 4,294,967,296 evenly. Take one random byte (0 to 255) and use it for 0 to 99: 256 is 2 x 100 + 56, so the numbers 0 to 55 each come from three byte values and 56 to 99 from only two, which is 1.17% against 0.78%. This tool uses rejection sampling instead. It finds the largest multiple of the range size that fits, throws away any random value above it and draws again, so every number gets exactly the same count of values. For 1 to 6, only 4 of the 4,294,967,296 values (about one in a billion) are redrawn. Ranges larger than 4,294,967,296 numbers join two 32-bit values, which is how the full plus or minus 2^53 range works.

Decimals are drawn as whole numbers in a scaled range. With 2 decimal places, 0.00 to 1.00 is the whole numbers 0 to 100: the tool draws one of those 101 numbers and writes it back with 2 places. Nothing is divided or rounded, so there are no results like 0.30000000000000004, and 0.37 is exactly as likely as 1.00. If you type more decimal places than the setting allows, the tool asks you to raise the setting instead of rounding for you.

Different numbers (no repeats) are drawn with a partial Fisher-Yates shuffle: one number from all of them, then one from those left, and so on, so every set and order of numbers is equally likely. If the range is too small you get a clear message, for example 11 different numbers cannot come from 1 to 10. With repeats allowed, each draw is independent, so repeats and runs are normal. Ten numbers from 1 to 10 are all different only 10! / 10^10 = 3,628,800 / 10,000,000,000, about 0.036% of the time.

How many values a range holds and the chance of one particular value in a single draw:
| Range | Possible values | Chance of one particular value |
| --- | --- | --- |
| 1 to 2 (a coin) | 2 | 50% |
| 1 to 6 (a die) | 6 | 16.67% |
| 1 to 10 | 10 | 10% |
| -5 to 5 | 11 | 9.09% |
| 1 to 49 | 49 | 2.04% |
| 1 to 100 | 100 | 1% |
| 0.00 to 1.00 (2 decimals) | 101 | 0.99% |
| 1 to 1000 | 1,000 | 0.1% |
| Sets of 6 different numbers from 1 to 49 | 13,983,816 | 1 in 13,983,816 for any particular set |

Q: Is this random number generator really random?
A: It is as random as your browser's cryptographic generator, crypto.getRandomValues. That is a pseudo-random generator seeded with enough entropy to be suitable for cryptography, not a physical source. For picking numbers, no practical test can tell its output from true randomness, and each number in your range has exactly the same chance.

Q: What is the difference between true random and pseudo-random numbers?
A: True random numbers come from a physical process such as electrical noise. Pseudo-random numbers come from a formula that starts from a seed. Browsers use the second kind for speed, seeded with enough entropy. Math.random is also pseudo-random, but MDN says it is not cryptographically secure, which is why this tool does not use it.

Q: What is modulo bias and does this tool have it?
A: Modulo bias is the small unfairness from taking a random value modulo the range size when the range does not divide the number of possible values evenly. Some results then come up slightly more often. This tool avoids it by rejection sampling: values from the uneven leftover part are thrown away and drawn again, so there is no modulo bias.

Q: How do I get random numbers without repeats?
A: Turn on Every number different. The tool then draws without replacement, so no number appears twice. The range must hold at least as many values as you ask for. If it does not, for example 11 different numbers from 1 to 10, you get an error that says how many values the range has.

Q: Can I use this to pick lottery numbers?
A: You can pick numbers, but it cannot improve your odds. Every set of six numbers from 49 is equally likely, and there are 13,983,816 sets. For a real lottery or prize draw, follow its own rules. This page is not an approved or audited draw.

Q: How big can the numbers be, and how many can I get?
A: Each limit can be anything from minus 9,007,199,254,740,992 to plus 9,007,199,254,740,992 (2^53), with up to 10 decimal places, and you can ask for 1 to 10,000 numbers at a time. The last 10 results are kept in the history list.

Q: Why did I get the same number twice in a row?
A: With repeats allowed, every draw is independent, so repeats are normal. In a range of 10 numbers the next number equals the last one 10% of the time. A number is never "due" because it has not appeared for a while.

Q: Can I use these numbers as a password or an encryption key?
A: This page is not made for secrets. The numbers are shown in plain text and kept in the on-screen history. For passwords use the password generator, which is built for that.

Q: Are my numbers stored or sent anywhere?
A: No. The numbers are made in your browser tab and nothing is uploaded, logged or stored. Closing the tab clears the history.

Sources: Crypto: getRandomValues() method - MDN (https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues); Math.random() - MDN (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random); Web Cryptography API - W3C (https://www.w3.org/TR/WebCryptoAPI/); Fisher-Yates shuffle, including modulo bias - Wikipedia (https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle); Lottery mathematics (6/49 combinations) - Wikipedia (https://en.wikipedia.org/wiki/Lottery_mathematics)

Related tools:

- [Dice roller](https://hirantha.me/tools/dice-roller.md): Roll up to 100 dice with 2 to 1000 sides, or type notation like 3d6+2, 2d20kh1 or 4d6dl1. See every die, the total and your history.
- [Coin flip](https://hirantha.me/tools/coin-flip.md): Flip a fair coin online: heads or tails with a running tally, a streak counter and up to 1,000 coins at once, from your browser's secure generator.
- [Password generator](https://hirantha.me/tools/password-generator.md): Generate a strong, random password with a length and character set you choose.
- [UUID generator](https://hirantha.me/tools/uuid-generator.md): Generate random version 4 UUIDs, one at a time or in bulk.
- [Mean, median, mode and standard deviation calculator](https://hirantha.me/tools/statistics-calculator.md): Paste a list of numbers to get the mean, median, mode, range, quartiles, and sample and population variance and standard deviation.
