Random Number Generator

Draw numbers, roll dice or pick names from a list using your browser’s cryptographic generator, with no modulo bias.

Processed on your device — no upload

termiva random --range 1-100

Every value comes from crypto.getRandomValues, the same generator your browser uses for encryption keys — not Math.random, which is predictable enough that it must never decide anything that matters. Values outside a whole multiple of the range are discarded and redrawn, so no number is even slightly more likely than another.

drawn 0source crypto.getRandomValuesbias none — rejection samplednothing uploaded

How to use it

  1. Choose numbers, dice, coins or a list.
  2. Set the range.
  3. Draw.

How it works

Every value here comes from crypto.getRandomValues, the generator your browser uses to produce encryption keys. It is seeded by the operating system from genuinely unpredictable sources and its output cannot be reproduced, even by someone who knows every value that came before.

The alternative is not good enough for anything that matters. Math.random is a fast arithmetic sequence, not a random source. Observe enough of its output and the rest is calculable. It is fine for animation timing. It should never decide a prize draw, a shuffle or anything with a winner.

Then there is modulo bias, which almost every simple generator has. The obvious way to get a number from 1 to 100 is to take a random value and divide by 100, keeping the remainder. But 100 does not divide the range evenly, so the low numbers get one extra chance each. Over a large enough sample the skew is measurable — and in a raffle, some entrants really are more likely to win.

This page uses rejection sampling instead: any value falling outside a whole multiple of the range is discarded and a new one drawn. It takes slightly longer and every outcome is exactly equally likely.

Drawing without repeats uses a partial Fisher–Yates shuffle over a sparse map, so picking six numbers from a million is instant rather than allocating a million-element array.

A worked example

A prize draw with 340 entries. Paste the names into the list, one per line, choose Draw winners and ask for three. You get three distinct entries — drawn as positions rather than picked three separate times, so nobody wins twice. Every name has the same chance, including the first and the last, which is not true of a generator with modulo bias.

Why doing this in the browser is the honest version. A draw run on someone else's server is a draw you have to take on faith. Here the entrant list never leaves your machine, and the page works with the network disconnected — you can prove nothing was sent by turning WiFi off first and drawing anyway.

Dice. Two d6 gives a total as well as the individual rolls, which is what a board game needs. The d20 is there for tabletop games. Physical dice are genuinely random; digital ones are only as good as their generator, which is the whole point of this page.

Ten thousand coin flips. Ask for them and the count comes back close to five thousand each — but not exactly, and the gap is usually larger than people expect. That is what real randomness looks like, and it is a useful demonstration for anyone who thinks a fair coin should land near 50/50 in a short run.

If what you actually need is a secret rather than a number, the password generator uses the same source with an alphabet instead of a range, and the UUID generator produces identifiers.

Questions

Is this actually random?

It uses your browser’s cryptographic generator, seeded by the operating system from unpredictable physical sources. It is the same generator used to create encryption keys.

What is modulo bias?

Taking a remainder to fit a random value into a range makes the lower numbers slightly more likely whenever the range does not divide evenly. This page discards and redraws instead, so every outcome is equally likely.

Can I use it for a real prize draw?

Yes. Draws are made without repeats, so nobody is picked twice, and the entrant list never leaves your device. For a regulated draw, keep a record of the entries and the result.

Is the result stored or logged?

No. Nothing is transmitted and nothing is saved. Reload the page and the draw is gone, so copy the result before you leave.

Can I reproduce a draw with a seed?

No, and deliberately so. A cryptographic generator has no seed to set. If you need a repeatable sequence you need a seeded pseudo-random generator, which is a different tool for a different job.

How many numbers can I draw at once?

Up to ten thousand. Drawing without repeats is capped by the size of the range, since you cannot pick more distinct numbers than exist in it.

Why is my coin flip result not exactly half heads?

Because it is genuinely random. Short runs deviate noticeably; the proportion converges only over very large numbers of flips.

Does it work offline?

Yes. Once the page has loaded it needs no network at all, which is also the simplest proof that nothing is being sent.