Skip to content
CalculatorsRuns in your browserPopular

Random Number Generator

Generate random integers, decimals or lists with no repeats.

Input
No upload needed — instant
Privacy
Nothing is uploaded
Cost
Free · no sign-up · no watermark

Loading tool…

The tool is loading its code on your device. This happens once and is cached for later visits.

Processed entirely on your device

Everything you type or paste is handled by JavaScript running in this tab. No request is sent, nothing is logged and nothing is stored. Close the page and it is gone.

Overview

About the Random Number Generator

Free random number generator. Single values, ranges, batches without duplicates, coin flips, dice rolls and list shuffling — all from a cryptographic source.

True randomness is harder to produce than it looks, and most random number generators in everyday software are not random in any meaningful sense — they are deterministic sequences that merely appear unpredictable.

Pseudorandom versus cryptographically secure

A pseudorandom number generator (PRNG) holds internal state and produces a deterministic sequence from it. Given the state, every future value is predictable. JavaScript's Math.random() is a PRNG — in V8 it is xorshift128+, whose state can be recovered from a handful of outputs.

A cryptographically secure PRNG (CSPRNG) is seeded from a hardware entropy source and designed so that observing output gives no information about future output, even in principle. crypto.getRandomValues() is one. It is what generates TLS keys, SSH keys and session tokens.

For a die roll, the difference is academic. For anything where an adversary benefits from prediction, it is the whole game — and since there is no performance cost worth mentioning, there is no reason to accept the weaker source.

Modulo bias, the subtle bug

The obvious implementation is:

Math.floor(Math.random() * (max - min + 1)) + min   // floating point, usually fine
randomByte % rangeSize                              // integer, often biased

The second form is the problem. If you need a value in 0–5 from a byte in 0–255, there are 256 possible inputs and 6 possible outputs. 256 is not divisible by 6, so four of the outputs can be produced by 43 inputs while two are produced by 42. Those four are about 2.4% more likely. Over a million draws the skew is plainly visible in a histogram.

The fix is rejection sampling: compute the largest multiple of the range that fits in the random space, and discard any value at or above it. You occasionally throw away entropy and draw again, but the output is exactly uniform. This tool does that.

Drawing without replacement

Producing N distinct values from a range is not the same as producing N values and filtering. The efficient correct approaches are:

  • Fisher–Yates partial shuffle — build an array of the range, shuffle only the first N positions. Best when N is a large fraction of the range.
  • Set-based rejection — draw and discard duplicates. Best when N is small relative to the range, because collisions stay rare.

This tool picks between them based on the ratio, so a raffle drawing 3 of 500 and a simulation drawing 900 of 1000 are both fast.

Common uses

UseSetting
Dice roll1 to sides, one value
Coin flip0 to 1, one value
Raffle winnerUnique draw from participant count
Lottery-style pick6 unique from 1–49, sorted
Random sampleN unique from population size
List shufflePaste items, use shuffle mode
Random decimal0 to 1, decimal mode

What randomness cannot give you

Fairness requires more than an unbiased generator. It requires that the range was fixed before the draw, that the inputs were what they appeared to be, and that the result was not regenerated until something acceptable came up. That last one is the failure mode no algorithm can detect: a tool that lets you press generate again gives you the ability to keep going until you like the answer, which is not a draw at all.

For genuinely auditable randomness, commit to the parameters publicly first, run the draw once, and record it.

Step by step

How to use the Random Number Generator

  1. Set the minimum and maximum of your range.

  2. Choose how many numbers you need and whether duplicates are allowed.

  3. Select integer or decimal mode, and set decimal places if relevant.

  4. Press Generate; values come from crypto.getRandomValues.

  5. Copy a single value, the whole list, or use the dice and coin shortcuts.

Why use it

Benefits and common use cases

What this tool is good for, and what it deliberately does not try to do.

Cryptographically secure

Every value comes from the operating system's entropy pool with rejection sampling to remove modulo bias — so the distribution is genuinely uniform, not merely approximately so.

Unique-value batches

Draw N distinct numbers from a range without repeats, which is what a raffle, a lottery simulation or a sample selection actually requires.

Beyond plain numbers

Coin flips, dice of any side count, and shuffling of a pasted list — the common special cases, without making you work out the mapping yourself.

Sorted or as-drawn

Display results in draw order or sorted, since lottery-style checks usually want sorted output while simulation work wants the original sequence.

Questions

Frequently asked questions

Short, honest answers about quality, limits and privacy.

Is this random enough for a real draw or raffle?

The underlying source is cryptographically secure and unbiased, which is stronger than most purpose-built draw tools. What it cannot provide is auditability — an observer cannot verify that the inputs were what you claimed. For a draw that must be demonstrably fair, record the screen, publish the parameters in advance, or use a verifiable scheme.

What is modulo bias?

The naive way to get a number in a range is to take a random byte modulo the range size. Unless the range divides the byte space evenly, some outputs become slightly more likely — rolling a 1 to 6 from a value of 0 to 255 favours the first four results. Rejection sampling discards values above the largest even multiple, eliminating the bias.

Why not just use Math.random()?

Math.random() is a fast pseudorandom generator with no guarantee of cryptographic quality, and its output can in principle be predicted from earlier values. For dice and raffles it would probably be fine, but there is no cost to using a proper source, so there is no reason to use an inferior one.

Can I reproduce a sequence later?

No, deliberately. A cryptographic generator cannot be seeded or replayed, so a sequence cannot be reproduced. If you need reproducible randomness — for testing, procedural generation or scientific simulation — you want a seeded PRNG in your own code, not this tool.

Are the numbers uniformly distributed?

Yes. Every integer in the inclusive range has exactly the same probability of being drawn, and batches without replacement are proper uniform samples without repetition — equivalent to drawing numbered balls from a bag.