WEB CRYPTO · CSPRNG 0 COOKIE · 0 TRACKING 1,333 draws v1.0.0
cybernet.fun / Randomness lab Italiano

Random number / random-number-1-1000

Random number 1-1000

Wide ranges, intact precision.

  • Sourcecrypto.getRandomValues()
  • Entropy—
  • draws105
RESULT —

Range preset to 1-1000. With a thousand values uniformity needs more samples to become visible: thousands of draws flatten the histogram, which is the whole point.

A naive generator computes random() % n. If the generator emits 2^32 values and n is not an exact divisor, some results appear more often: that is modulo bias, measurable and exploitable. Here we use rejection sampling: draw a 32-bit integer and discard it until it falls inside the largest exact multiple of n. Residual bias is exactly zero.

Ranges are normalized before drawing, and very wide ranges are composed from two words so the value stays inside JavaScript exact 53-bit integers: no precision loss, no silent rounding.

How it works

  1. 01Set minimum and maximum. Reversed values are reordered, decimals rejected.
  2. 02Choose how many numbers to draw and whether they must be unique: drawing is without replacement.
  3. 03Every click updates the session histogram, which is how uniformity becomes visible.
Advertisement
Sponsor

Space available. One sponsor per page, no tracking.

or remove ads with Pro →

Frequently asked

Random number generator

Why not Math.random()?

Because it is deterministic and unfit for anything involving security or verifiable draws. V8 seeds it with a reconstructible state; crypto.getRandomValues() reads the OS entropy pool.

What is the maximum range?

Up to 2^53 distinct values, about nine quadrillion. Beyond that floating point precision is not guaranteed, and the tool says so instead of returning wrong values.

Can I reproduce the same sequence with a seed?

No, by design: there is no settable seed. For reproducible simulations you need a seeded PRNG, not a CSPRNG.

Related tools