Skip to content
zeal.tools

Random Number Generator

Random numbers between any two values — one or a thousand, with or without repeats — drawn fairly from your operating system's random source. Coin flips and dice too.

Range and options

Repeats

Both ends are included: 1 to 6 can give 1 and can give 6. Copying puts one number per line, ready to paste into a spreadsheet column.

Flip a coin → Dice roller → Name picker wheel → Password generator →
Table of contents

How to generate a random number

  1. 1

    Set the range

    Type a minimum and a maximum, or press one of the common ranges. Both ends are included, so 1 to 10 can give you 1 and can give you 10. Negative numbers work, and so do ranges in the trillions.

  2. 2

    Choose how many

    One number, or up to a thousand at once. Tick No repeats for a draw where each number can come up only once — a lottery line, a raffle ticket order, a random sample. Pick an order, and add decimal places if you need them.

  3. 3

    Draw, copy, share

    A number is already on screen; press New number to draw again with the same settings. Copy puts one number per line. The address bar holds your settings — never the result — so a link opens the same generator, ready to draw.

Why every number is equally likely

A random number generator has two jobs, and most of them only think about the first. The first is a source of randomness nobody can predict. Here that is crypto.getRandomValues, the cryptographic generator the browser takes from your operating system, which gathers unpredictability from the hardware and is what encryption keys are made from. It is not Math.random, which is built for speed: fine for a game’s sparkle, but its next value can be worked out from the ones before it.

The second job is turning random bits into your range without tilting it, and this is where generators quietly go wrong. Random bits come in powers of two; your range almost never is one. Squeeze 256 equally likely byte values into the numbers 1 to 6 with a remainder and four of the six get one extra way to happen. Scale a random fraction up to the range instead and floating-point rounding makes some values fractionally more common, and the top of the range becomes unreachable.

This generator does neither. For a range of n values it reads just enough bits to count to n, and if the value lands past the end it throws it away and reads again. Every value that survives was reached by exactly one pattern of bits, so all of them are equally likely — exactly, not approximately. Fewer than one draw in two is ever thrown away, so it costs nothing you could notice, even for ranges in the trillions.

No repeats uses the same draw inside a shuffle that only touches the positions it needs, so asking for a thousand different numbers from a range of a trillion takes a thousand steps, not a trillion. Decimals are handled as whole numbers on a finer grid and divided at the end, which keeps both ends reachable at any precision.

You do not have to take our word for it

Fairness you cannot check is just a claim, so here is how to check it. Set the range to 1 to 10, the count to 1,000, and leave repeats on. Each number should turn up about a hundred times — usually somewhere between 80 and 120, because real randomness is lumpy. A generator that gives you exactly a hundred of each is the suspicious one.

The code is open and tested. The unit tests feed the draw every possible byte in turn and confirm each outcome comes up the same number of times, which is the test a modulo fails. They also run a chi-square test — the standard statistical check for an even spread — over tens of thousands of draws. You can read both, and the few dozen lines that do the drawing, in the repository.

And for the sceptical: open your browser’s network panel and press New number. Nothing is requested. The draw happens on your machine, which also means it keeps working with the internet switched off once the page has loaded.

Frequently asked questions

API — for scripts and agents

The same draw behind a free REST endpoint, no key and no sign-up. It takes min, max, count, unique, sort (none, asc or desc) and decimals; or coin=10 for ten flips; or dice=2d6%2B3 for a roll — write + as %2B, since a bare plus in a URL means a space.

curl 'https://zeal.tools/api/v1/random?min=1&max=49&count=6&unique=true&sort=asc'

Try it: /api/v1/random?min=1&max=100, ?coin=10 or ?dice=4d6kh3. A result drawn there is drawn on our server, not in your browser; nothing is stored or logged.

Agents especially should use it: a language model asked for “a random number” returns a likely-sounding one, with a few favourites coming up far more often than chance allows. MCP clients can add https://zeal.tools/mcp and call the random tool for numbers, flips and rolls.

The Zeal Promise

Non-negotiable, on every tool we ship.

  • No sign-up — ever
  • No watermarks on any output
  • No ads near the download button
  • Works fully on mobile
  • Privacy-first: processing stays in your browser
  • Open source (MIT) — audit it, contribute, self-host
  • Zero runtime dependencies in tool logic