Skip to content
Calculator.hair

Random Number Generator

Press Generate to see a result.

Comprehensive Version

Generate one or many random numbers between two limits. Choose whole numbers or decimals, set how many digits a decimal keeps, decide whether a value may repeat, and sort the list if you like.

numbers
Type of result to generate?
digits

Press Generate to see a result.

This random number generator picks a number between a lower and an upper limit, both included. The comprehensive version below it can produce many numbers at once, as integers or as decimals with up to 50 digits after the point, with optional sorting and no repeats.

A random number is a value chosen so that no one can predict it in advance, and so that every allowed value has the same chance of being picked. The simple generator at the top draws one whole number between the two limits, counting both ends, so the default range of 1 to 100 has exactly 100 equally likely outcomes. It is a quick way to settle who goes first, pick a raffle winner from numbered tickets, choose a random page in a book or roll a virtual die of any size.

The comprehensive version handles everything else. It accepts decimal limits, returns as many as 1,000 values at once, and can work with decimals of up to 999 digits by doing exact integer arithmetic instead of ordinary floating point. Turning off duplication makes it behave like drawing tickets from a hat without putting them back, which is what you want for lottery-style picks or for choosing a random sample of rows from a list.

Computers are deterministic machines, so they cannot invent randomness out of nothing. Most software uses a pseudo-random number generator (PRNG): a formula that starts from a seed value and produces a long sequence of numbers that pass statistical tests for randomness. Given the same seed, a PRNG repeats the same sequence exactly, which is useful for simulations that must be reproducible but unacceptable for passwords or encryption keys.

True random number generators instead measure an unpredictable physical process, such as electrical noise, the timing of radioactive decay or tiny variations in hardware. Modern operating systems mix such sources into a cryptographically secure generator. This page uses that secure source through the browser's Web Crypto interface and maps the raw bits to your range with rejection sampling, which removes the slight bias that the common shortcut of taking a remainder introduces.

Random numbers are used far beyond games of chance. Statisticians rely on them to choose survey respondents and to assign patients to treatment groups in clinical trials, so that the groups differ only by chance. Engineers and scientists run Monte Carlo simulations, repeating a model thousands of times with random inputs to estimate risks that have no neat formula. Software testers feed random data into programs to uncover rare bugs, and teachers use random picks to call on students fairly.

Frequently asked questions

Are both limits included?

Yes. A range of 1 to 10 can return 1, 10 or any whole number between them, each with the same probability of 1 in 10.

How do I generate several numbers without repeats?

Use the comprehensive version, set how many numbers you need, and choose No for duplication. The range must contain at least that many different values.

Can I generate random decimals?

Yes. Choose Decimal in the comprehensive version and set the precision, the number of digits after the decimal point. Every value with that many digits inside the range is equally likely.

Is this random number generator truly random?

It uses the cryptographically secure generator built into your browser, which is seeded from unpredictable hardware events. It is suitable for games, drawings and sampling.

How do I pick a random number from 1 to 6 like a die?

Set the lower limit to 1 and the upper limit to 6 in the simple generator and press Generate. Each face has a one in six chance.

Updated by Calculator.hair. How we build and check our calculators