Home / Calculators / Random Number Generator

Random Number Generator

Outsource the decision to mathematics: fair random numbers in any range, dice with any number of sides, and coin flips — all drawn from your browser's cryptographic random source.

—

Uses cryptographic randomness (crypto.getRandomValues) with rejection sampling — every outcome equally likely.

Overview

Some choices should not be made by a person. When a teacher picks a name from a hat, everyone watches the hand; when software picks, everyone should be able to trust the method. This page makes the method trustworthy: it draws from the operating system's cryptographic entropy pool and removes the subtle bias that sneaks into ordinary random-number code, so each outcome is exactly as likely as every other.

Three modes handle the everyday cases. Numbers mode draws integers in any range you set, with options for unique-only draws and sorted output. Dice mode rolls up to twenty dice with up to a hundred sides each and totals them. Coin mode flips up to fifty coins and counts the heads. Results copy to the clipboard in one click.

Why do humans make bad random pickers?

Because the brain is a pattern engine, not a dice. Asked to name a random number between 1 and 10, people say 7 far more often than chance allows; asked to invent a random sequence, they alternate too neatly and avoid repeats that real randomness produces constantly. Any draw a person performs carries these fingerprints, which is why lotteries use machines and courts use supervised draws.

The software trap is subtler. Most programming languages ship a pseudo-random generator that is deterministic under the hood — fine for shuffling a playlist, dangerous when fairness must be defended. On top of that, the common shortcut of taking a random value modulo the range size favours low numbers slightly. This tool avoids both: it uses crypto.getRandomValues() and discards out-of-range draws (rejection sampling), the combination cryptographers insist on.

Features

Benefits

Who can use it

Teachers selecting students or forming groups, organisers running raffles and giveaways, tabletop gamers rolling unusual dice, friends settling who goes first, developers generating quick test data, and researchers randomising the order of trials. Anyone who needs chance to be visibly fair — where the process matters as much as the result — will find the cryptographic method worth mentioning.

How to use

  1. Choose Numbers, Dice or Coin at the top of the panel.
  2. In Numbers mode, set the minimum, maximum and how many draws you want; tick unique-only or sort as needed.
  3. In Dice mode, set the number of dice and sides per die; in Coin mode, set how many coins to flip.
  4. Press Generate — and press it again any time for a fresh draw.
  5. Copy the results with one click when you need them elsewhere.

Frequently asked questions

Can I trust this for a prize draw?

The mathematics is beyond reproach: cryptographic entropy plus rejection sampling is the gold standard for uniform draws. What the page cannot supply is ceremony — for anything with real stakes, run the draw on a screen everyone can see, announce the method, and keep a record of the result. Fairness people can watch beats fairness they must take on faith.

What is wrong with the random function in normal code?

Two things. First, most built-in generators are deterministic sequences — impressive for games, replayable by anyone who learns the seed. Second, squeezing a big random value into a smaller range with the remainder operator favours some outcomes, because the big range rarely divides evenly. Both problems vanish with a cryptographic source and rejection sampling.

Why does unique-only refuse some requests?

Because the request is mathematically impossible: ten different numbers cannot come from a range of five. Rather than spinning forever or quietly repeating values — both of which would be dishonest — the tool states the problem plainly. Widen the range, reduce the count, or switch unique-only off, and the draw will proceed.

How do I get decimals instead of integers?

Draw integers and divide — the uniformity survives the division. Generating 1–1000 and dividing by 100 yields values from 0.01 to 10.00 in exact steps of 0.01, every step equally likely. Integers are the native output because dice, lotteries, draws and sampling all deal in whole outcomes; the division trick covers everything else cleanly.

Does the page remember my draws?

No, and that is by design rather than by omission. Each draw exists in the tab's memory only until the next draw replaces it. There is no history panel, no log file and no network request — closing the tab is a complete erasure, which is exactly how a fairness tool should behave.

Conclusion

Chance deserves better than a hunch. With cryptographic entropy and rejection sampling, every draw is uniform by construction — so set the range, press Generate, and let mathematics settle it.

Related tools

CalculatorsStopwatch & TimerA precise stopwatch with laps, plus a countdown alarm. CalculatorsPercentage CalculatorDiscounts, shares and change — three calculators in one. SecurityPassword GeneratorStrong random passwords with a live entropy meter.