Utilities

Random Number Generator

Generate truly fair random numbers in any range: whole numbers or decimals, one or thousands at once, with or without duplicates, sorted if you like.

Random Number Generator
Choose a range and how many numbers you want, then press Generate.
Quick picks:
Number type
Result

Press Generate to draw a number.

Results come from your browser's cryptographic random number generator with unbiased sampling, and nothing leaves your device.

History

Your recent draws will appear here.

About this tool

The Random Number Generator picks numbers between any minimum and maximum you set, including negative numbers and very large ones. Choose whole numbers or decimals with 1 to 10 decimal places, how many numbers you want (up to 10,000 at a time), whether duplicates are allowed, and whether to sort the results. If you ask for more unique numbers than the range holds, it tells you exactly how many are possible instead of failing quietly. Quick picks cover 1 to 10, 1 to 100, a lottery-style 6 from 49 and a 0 to 1 decimal. Copy the results separated by commas, new lines or spaces, and look back at your recent draws in the history. Numbers come from your browser's cryptographic random generator using rejection sampling, so every value in the range is exactly equally likely, and decimals are handled exactly rather than with floating point. Everything runs in your browser.

How to use the Random Number Generator

  1. Enter the minimum and maximum, or tap a quick pick such as 1 to 100 or 6 from 49.
  2. Set how many numbers you want, and choose whole numbers or decimals with a number of decimal places.
  3. Turn off Allow duplicates if every number must be different, and choose a sort order if you want one.
  4. Press Generate (or Enter) to draw the numbers.
  5. Copy the results with commas, new lines or spaces, and check earlier draws in the history.

Use it from your code

The Random Number Generator is also a REST API endpoint. Create a free API key and call it from your own scripts and apps.

# Six lottery numbers from 1 to 49, no repeats
curl -X POST https://opentools.ca/api/v1/tools/random-number-generator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"min": 1, "max": 49, "count": 6, "allowDuplicates": false, "sort": "asc"}'

Give us your feedback

Help us improve Random Number Generator!

Frequently asked questions

Are the numbers really random and fair?

They come from crypto.getRandomValues, the same cryptographically secure generator browsers use for encryption keys, not Math.random. To turn its random bits into your range without bias, the tool uses rejection sampling: it draws just enough random bits to cover the range and throws away any draw that falls outside it, rather than using a remainder (modulo), which would make some numbers slightly more likely. The result is that every number in your range has exactly the same chance.

How does "no duplicates" work?

Each number can appear at most once, like drawing balls from a bag. If you ask for more numbers than the range contains (for example 11 different numbers between 1 and 10) the tool tells you how many are possible. Every possible set of numbers is equally likely.

How are decimals chosen?

With 2 decimal places, a range of 0 to 1 holds the 101 values 0.00, 0.01 up to 1.00, and each is equally likely. The maths is done on exact whole numbers behind the scenes, so you will not see rounding artefacts like 0.30000000000000004.

Are the minimum and maximum included?

Yes. Both ends of the range can be drawn. A range of 1 to 6 works like a die.

Can I use it for a real lottery or prize draw?

The randomness is strong enough, but if a draw has legal or financial consequences, follow the rules that apply to you, which often require an independent witness or a certified process. For giveaways, consider recording your screen while you draw.

Is anything sent to a server?

No. The numbers are generated in your browser, and the history disappears when you close or reload the page.

Random Number Generator screenshot