TTKTheTextKit

Random Number Generator

Choose a minimum and a maximum, say how many numbers you want, and press Generate. You can pick whole numbers or decimals, forbid repeats for a draw or a lottery, and sort the result. Every value in the range is exactly as likely as every other, the numbers come from your browser's secure random source, and nothing is uploaded or stored.

Up to 10,000.

Related Tools

[4 suggestions]

About the Random Number Generator

The random number generator draws numbers from the secure random source built into your browser, the same one used for cryptography, not from Math.random. Each number is made from just enough random bytes to cover the range, and a draw that would favour some values is thrown away and repeated. This matters: a common shortcut takes a random value and keeps the remainder after dividing by the size of the range, and that makes the low values more likely. With one random byte and a range of 6, for example, the values 1 to 4 would come up 43 times in 256 and the values 5 and 6 only 42 times. The tool avoids this, and feeding it every possible byte string shows that every result appears the same number of times. Ranges can be huge, because whole numbers are handled exactly up to 40 digits, and decimals are drawn from an exact grid, so 0 to 1 with 4 decimals has 10,001 equally likely values. The no repeats option never returns the same number twice, and if you ask for more numbers than the range holds it tells you why that is not possible. You can ask for up to 10,000 numbers at once. The generator was tested with a chi-square test on more than 55 million draws, and every p-value was between 0.17 and 0.96, which is what a fair generator gives. For passwords, use the Password Generator instead. Everything runs in your browser and nothing is uploaded.

Is this random number generator truly random?▾

It uses your browser's cryptographically secure random source, so the numbers are unpredictable and follow no pattern. It is as good as a computer can offer for games, draws and tests.

How do I pick random numbers with no repeats?▾

Tick No repeats and ask for as many numbers as you need, up to the size of the range. For a lottery style draw of 6 from 1 to 49, set the minimum to 1, the maximum to 49, how many to 6 and tick No repeats.

Why is Math.random not good enough?▾

Math.random is not designed to be unpredictable and its quality is not specified, so it should not be used for anything that needs fairness or security. The secure source in the browser is meant for that. The remainder shortcut is a separate problem: it makes some values more likely even with a perfect source.

Can I generate random decimals?▾

Yes. Choose the number of decimal places. The tool draws from every value on that grid between the minimum and maximum, so 0 to 1 with two decimals gives one of 101 values, from 0.00 to 1.00, each equally likely.

Is what I generate stored or sent anywhere?▾

No. The numbers are made in your browser and are not sent anywhere or saved. When you leave the page, they are gone.