Skip to content
ZeroServer.tools

Random Number Generator

Generate random numbers (integers or decimals) using the Web Crypto API.

0 numbers
Count: 0Range: 1 to 100Decimals: 0

Random number generation

All numbers are generated using Web Crypto API.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Drawing a number for a raffle or a decision you want to leave to chance.
  • Generating a set of values to populate a test fixture.
  • Producing a bounded random input to exercise a validator.
  • Generating unique numbers within a range for a sampling task.
  • Producing a bulk list you then sort to inspect the distribution.

Frequently Asked Questions

Is this random enough for security?
It uses the browser's crypto.getRandomValues, a cryptographically secure PRNG seeded by the operating system — so yes for tokens and keys. Math.random() is NOT secure and must never be used for secrets; it is a fast statistical generator only.
Is the range inclusive at both ends?
Yes — a 1 to 10 range can return both 1 and 10. This matters more than it sounds: off-by-one at the boundary is the most common bug in hand-rolled range code, usually from Math.floor(Math.random() * max) which silently never returns max.
What is modulo bias?
Taking a random byte mod 10 makes values 0-5 slightly likelier than 6-9, because 256 is not divisible by 10. Correct implementations reject and redraw values in the biased tail. It is invisible in casual use and fatal in a lottery or a key.
Can I get unique numbers with no repeats?
Enable the no-duplicates option, which draws without replacement. Note the count then cannot exceed the size of the range — asking for 20 unique values between 1 and 10 is impossible, not merely unlikely.
Is a truly random sequence supposed to look clumpy?
Yes. Genuine randomness produces runs and repeats far more often than intuition expects — seeing 7 three times in twenty draws is unremarkable. Sequences that look evenly spread are usually the ones that have been tampered with.
What is a seed and when do I want one?
A starting value that makes a sequence reproducible. It is exactly what you want for a test that must fail the same way twice, and exactly what you do not want anywhere the value must be unpredictable.
Why is rejection sampling used to avoid bias?
Because taking a random value modulo a range favours the low end whenever the range does not divide evenly. Rejecting and redrawing the values in the uneven tail costs an occasional extra draw and removes the skew entirely.
Does a uniform distribution mean every batch looks even?
No — that expectation is the gambler's fallacy. Runs and gaps are exactly what randomness produces, and a sequence deliberately smoothed to look even is measurably less random than one that clumps.

Common errors and gotchas

  • Assuming the bounds are inclusive at both ends, which differs between implementations.
  • Using it where cryptographic randomness is required, which is a different guarantee.
  • Requesting more unique values than the range contains, which cannot be satisfied.
  • Reading a short run's clustering as bias, when clustering is exactly what randomness produces.
  • Re-rolling until a result looks random, which makes the outcome less random rather than more.

Related Generators tools

Private & free — this tool runs entirely in your browser.

CloudwaysManaged cloud hosting on AWS, GCP & DO — from $11/mo.affiliate