IZN Tools

Random Number Generator

A range, a count, and an option for no repeats.

Waiting for input
Uses the browser's crypto random source. Fine for sampling and test data; use a real key generator for secrets.
Computed on this device

Random enough for what

Not every use of "random" needs the same guarantees.

| Use | What it needs | | --- | --- | | Picking a test case | anything, Math.random included | | Shuffling a playlist | uniform, unbiased | | A prize draw | unbiased and verifiable by observers | | A secret key | cryptographic, never reused |

This tool covers the first three on unbiasedness. It cannot cover verifiability, because no page running only on your device can prove to anyone else what it did.

Modulo bias, and why it is avoided here

The obvious way to map a random 32-bit integer onto 1–10 is value % 10. It is also wrong: 2³² is not divisible by 10, so the first six values come up very slightly more often. Over a handful of draws nobody notices; over millions it is measurable. Drawing again when a value falls outside the usable range removes the skew entirely, at the cost of an occasional extra draw.

Without repeats

Sampling without replacement is what you want for picking winners, assigning seats, or choosing a subset of test rows. The range has to be at least as large as the count — the tool checks this and tells you the maximum rather than quietly returning fewer numbers than you asked for.

Nothing is sent anywhere

The draw happens in your browser, and the numbers are never transmitted or logged. Reload the page and the previous draw is gone for good.

Questions

Is this random enough for a prize draw?+

It uses `crypto.getRandomValues`, the browser's cryptographic source, not `Math.random`. That is genuinely unpredictable and unbiased. What it cannot give you is *auditability* — nobody watching can verify the draw happened as claimed. For a public draw, use a method observers can check, or a service that publishes a verifiable seed.

Why can I not get 100 unique numbers from 1 to 10?+

Because only ten distinct values exist. Without repeats the count can never exceed the size of the range, and the tool says so rather than silently returning ten.

Is the distribution actually uniform?+

Yes. Naive implementations take a random integer modulo the range size, which makes the lowest values slightly more likely — the classic modulo bias. This rejects out-of-range draws instead, so every value has an equal chance.

Can I use this to generate passwords?+

The randomness is strong enough, but a list of numbers is a poor password. Use a dedicated password generator, which draws from a full character set and gets the length right.