Loona Calculators
Loona Calculators › Fun › Random Number Generator

🎲 Random Number Generator

Generate truly random numbers in any range, right in your browser. Unlike most online generators, this one uses your browser's secure random source — the same one websites use for encryption — so the results are unpredictable and unbiased.

How to use the Random Number Generator

  1. Enter the smallest number (minimum) and the largest number (maximum) you want.
  2. Choose how many numbers to generate (up to 10,000).
  3. Pick whether numbers must be unique or may repeat, then press Generate Numbers.
Example: A teacher needs 6 students picked fairly from roll numbers 1 to 40: set minimum 1, maximum 40, count 6, unique only — six different roll numbers appear, with no favoritism possible.

Frequently Asked Questions

Is this random number generator truly random?

It uses crypto.getRandomValues, the cryptographically secure random source built into every modern browser. Operating systems feed it from real-world unpredictability (timing, hardware noise), so the numbers cannot be predicted or repeated on demand — a much stronger source than the Math.random function most simple generators use.

What does the unique option do?

With 'unique numbers only', every generated number is different — ideal for lottery-style draws, raffles and picking students or winners. With 'repeats allowed', each draw is independent, so the same number can appear more than once, like rolling dice.

Can it repeat the same set twice?

In theory any set can occur again by chance, but with secure randomness there is no pattern, seed or memory between draws. Pressing Generate always starts a completely fresh, independent draw.

Related Calculators

🎲

Dice Roller

Fun

🪙

Coin Flip

Fun

🍀

Lottery Number Generator

Fun

❤️

Love Calculator

Fun

📅

Age Calculator

Date & Time

How it works — the formula

The generator uses rejection sampling on 32-bit secure random values, which removes the subtle bias of simpler methods:

1. The browser fills a 32-bit unsigned integer x using crypto.getRandomValues.
2. Let range = max − min + 1. Values of x at or above limit = ⌊2³² ÷ range⌋ × range are rejected and redrawn, so the remaining values divide evenly by the range.
3. The result is min + (x mod range) — every number in your range has exactly the same probability.

Worked example

Example: Drawing one number from 1 to 6 (a die roll). The range is 6, so limit = ⌊4,294,967,296 ÷ 6⌋ × 6 = 4,294,967,296 − 4 = 4,294,967,292. Almost every random 32-bit value is accepted; if x = 1,000,000,007, then 1,000,000,007 mod 6 = 5, and the result is 1 + 5 = 6. Each of the six outcomes is exactly equally likely.

Frequently asked questions

What is the largest range and count?

You can generate up to 10,000 numbers per draw, and the range can span billions of values (the tool works with whole numbers; decimals you type are rounded down to whole numbers).

Are my numbers sent to a server or stored?

No. The generator runs entirely in your browser using JavaScript. Nothing is uploaded, logged or stored — close the tab and the numbers are gone.

Why not just use Math.random?

Math.random is a pseudo-random generator designed for convenience, not fairness: its sequence is deterministic and can in principle be predicted. For draws, giveaways and games, a secure source matters, which is why this tool is built on crypto.getRandomValues with rejection sampling so every value in your range is equally likely.

Embed this calculator on your website — free

Add this calculator to your own website or blog — it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the calculator to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.