Skip to content

Random Number Generator

Draw numbers from a range, with or without repeats, using the browser's cryptographic generator rather than Math.random.

Runs entirely in your browser — nothing is uploaded

Not Math.random

The obvious way to write this would use Math.random, and browsers make no promise at all about its quality — it is specified only as “implementation-dependent” and has historically been poor in several engines.

This uses crypto.getRandomValues, the browser’s cryptographic generator. For picking a raffle winner or an order of speakers, the difference is one you will never see; for anything anyone might dispute, it is the difference between a defensible draw and a plausible one.

Why a modulo would skew the result

Turning a 32-bit random value into a number from 1 to 100 with a remainder looks correct and is not quite. 232 does not divide by 100, so the first 96 values in the range come up very slightly more often than the last four.

The bias is tiny and it is real. This generator throws away values that fall in the incomplete final bucket and draws again, which costs nothing and makes every number in the range equally likely.

With or without repeats

Repeats allowed is the right setting for dice, for simulations, and for anything where each draw is independent. Without repeats is what a raffle needs — the same ticket cannot win twice.

Asking for more unique numbers than the range contains is impossible rather than slow, and the tool says so instead of running forever.

Nothing is sent anywhere

Every figure on this page is worked out in your own browser. No request is made, nothing is stored between visits, and the page keeps working with the connection switched off.

Frequently asked questions

Is this random enough for a prize draw?

For an informal one, comfortably. It uses the browser's cryptographic generator with the sampling bias removed. For anything legally regulated, use whatever your jurisdiction requires — that is a question about rules and auditing, not about mathematics.

Can I get the same numbers again?

No, and that is deliberate. There is no seed, because a reproducible draw is a different tool for a different purpose. Copy the result if you need to keep it.

Are both ends of the range included?

Yes. From 1 to 100 can produce 1 and can produce 100. Off-by-one at the boundaries is the classic bug in this kind of tool, and the range here is inclusive at both ends.

Is anything sent anywhere?

No. The numbers are generated in this tab and never leave it.