Random Number Generator
Generate random numbers in a range, without modulo bias.
What you provide
Result
22
Generated with crypto.getRandomValues using rejection sampling, so every value in range is equally likely — no modulo bias toward the lower numbers.
- Number
- 22
- Range
- 1 to 100 inclusive
What this cannot tell you
- Uses the browser’s cryptographic randomness (crypto.getRandomValues). Suitable for general use; for security tokens use the dedicated password tools.
- Bounds are inclusive.
Take this with you
How this calculation works
Numbers are drawn with crypto.getRandomValues and rejection sampling, so every value in the range is equally likely — a naive modulo would subtly favour the smaller numbers.
What the results mean
- No modulo bias
- Taking a raw random value modulo the range size skews toward lower numbers when the range does not divide evenly. Rejection sampling avoids that.
Common problems and fixes
- The same number came up twice in a row
- That is what independent draws look like — each one has no memory of the last, so repeats occur at exactly the rate probability predicts. A generator that avoided them would be drawing without replacement, which is a different operation and produces a different distribution. Genuine randomness always looks less even than people expect.
- I need numbers without repeats
- You want a shuffle or a draw without replacement rather than independent random numbers. Generate more values than you need and remove duplicates, or list the candidates and shuffle them. For a raffle where each ticket can win only once, that distinction is the whole difference between a fair draw and a broken one.
- The results do not look random enough
- Clustering and streaks are properties of real randomness, not evidence against it. Human intuition expects an even spread and treats any run as suspicious, which is precisely why people are bad at generating random sequences by hand. Over a large number of draws the distribution flattens; over a small one it never will.
Frequently asked questions
Is this random enough for a lottery or draw?
For a casual draw, yes — it uses the browser’s cryptographic randomness, which is far better than Math.random. For anything with money or legal weight at stake, use a purpose-built, auditable system rather than a web page.
What is modulo bias?
The skew introduced by taking a raw random value modulo a range that does not divide its output space evenly. Some results then have one more way of being produced than others, making low values slightly more likely. It is invisible in a handful of draws and measurable over thousands, which is why this uses rejection sampling instead.
Is this suitable for a competition draw?
The randomness is sound — cryptographic source, no modulo bias. What a web page cannot give you is auditability: there is no record that the draw happened as described, no timestamp anyone else can verify, and nothing to show a regulator. For a draw with legal weight, use a system built to produce that evidence.
Put this on your own site
Free to embed, no attribution required beyond the source link the frame carries itself. It runs entirely in your visitor's browser, sets no cookies and loads no third-party script.
<iframe src="https://runthetests.com/embed/random-number-generator/" width="100%" height="560" style="border:1px solid #e5e5e5;border-radius:8px" title="Random Number Generator" loading="lazy"></iframe>
Preview it at https://runthetests.com/embed/random-number-generator/. Embedded pages are marked noindex, so yours stays the canonical copy — not this one.