Random Number Generator

Pick a range, say how many numbers you want, and generate. Two things separate this from the usual implementation. The numbers come from crypto.getRandomValues, the browser's cryptographic generator, not Math.random — whose output is predictable from earlier values and which the specification itself says not to use for anything that matters. And the range is handled without modulo bias: taking one random value modulo the range, which is what almost everything does, makes lower numbers slightly more likely unless the range happens to divide evenly. Unusable draws are rejected and redrawn instead, which costs an occasional extra draw and makes every outcome exactly equally likely. Options cover decimals, no-repeats, exclusions and sorting. Nothing is generated on a server, so no result is ever recorded.

Two ways to pick a number in a range

ApproachDistribution
Math.random × rangePredictable source, uneven at the edges
Random 32-bit % rangeLow values slightly more likely
Reject and redrawExactly uniform — what this uses

When to use it

  1. Draw a fair winner for a giveaway or raffle.
  2. Pick lottery-style numbers without repeats.
  3. Generate test data within a known range.
  4. Choose a random sample of row numbers from a data set.
  5. Roll dice, or pick a number between one and a hundred.

How to Use

  1. Set the minimum, maximum and how many you want.
  2. Switch on no-repeats or decimals if you need them.
  3. Press Generate, and copy the result.

Features

  1. Cryptographic randomness, not Math.random
  2. Rejection sampling — no modulo bias
  3. Whole numbers or decimals to four places
  4. No-repeats with a feasibility check
  5. Exclude specific values
  6. Optional sorting, all client-side

FAQs

Is this actually random?

It uses crypto.getRandomValues, which draws from the operating system's entropy pool — the same source used for cryptographic keys. That is as close to unpredictable as software gets, and far better than Math.random, whose future output can be reconstructed from past values.

What is modulo bias and why should I care?

The common shortcut is to take a random 32-bit number and apply modulo the range. Unless the range divides 2^32 exactly, the leftover at the top wraps back onto the start, so the lowest values come up slightly more often. For a dice roll this is invisible; for a prize draw it is a real unfairness that nobody would ever notice. This tool rejects and redraws instead, so the distribution is exactly flat.

Why was my unique request refused?

Because there are not enough different numbers in the range to fill it — ten unique values between one and five is impossible. The tool says how many are actually available rather than looping forever. Exclusions count against the total, which is how a request that looks possible can turn out not to be.

Can I get the same numbers again?

No. There is no seed, deliberately: a seeded generator is reproducible, which is the opposite of what a draw needs. If you need repeatability for testing, a seeded generator in your own code is the right tool.

Are my results stored anywhere?

No. Everything is generated in your browser and nothing is transmitted or logged, which matters if you are using this to pick a winner and need to be able to say so.

Technical Details

Numbers come from crypto.getRandomValues, the browser's cryptographic generator, rather than Math.random, whose output is predictable from previous values and explicitly documented as unsuitable for anything security-related. More subtle, and the thing almost every implementation gets wrong: taking a random 32-bit value modulo the range is not uniform. Unless the range divides 2^32 exactly, the lower values occur slightly more often, because the leftover portion at the top of the 32-bit space maps back onto the start of the range. For a six-sided die the bias is negligible; for a prize draw over an awkward range it is real, and it is the kind of unfairness nobody notices. So the unusable tail is rejected and redrawn — occasionally one extra draw, and every outcome exactly equally likely. Decimals use 53 bits assembled from two 32-bit draws rather than one, because a single draw provides only 32 bits of resolution and leaves visible gaps in the spread at high precision. Unique generation checks feasibility before it starts and refuses an impossible request with the count of what is actually available, rather than looping until the tab freezes — asking for ten unique numbers between one and five is the obvious case, but excluding values makes it possible to ask for something impossible without noticing. An attempt ceiling catches the near-impossible case where the range is only slightly larger than the count.

Calculators & Converters

Calculators & Converters

  • GPA Calculator
  • Tip Calculator
  • Age Calculator
  • Date Difference Calculator
  • Percentage Calculator
  • Loan Calculator
  • VAT Calculator
  • VAT Calculator (UK)