Random Number Generator

Generate random integers, decimals, or lists between any minimum and maximum values.

Random Number Generator

Random Number Generator Formula & How It Works

Uniform random: X ~ U[min, max] | Integer: floor(random() × (max−min+1)) + min
  • random() generates uniform float in [0, 1)
  • Integer in [a,b]: floor(random() × (b−a+1)) + a
  • Computer RNG is pseudo-random (deterministic with seed)
  • Cryptographic RNG: uses hardware entropy for security

Computer random number generators are pseudo-random: they use mathematical algorithms seeded with initial values (often system time or hardware entropy) to produce sequences that appear random. For statistics and simulations, pseudo-random is sufficient. For cryptography, use cryptographically secure RNG (CSPRNG).

Random Number Generator FAQs

Is a computer random number truly random?

Standard RNGs are pseudo-random — deterministic algorithms that produce statistically random-looking sequences. Given the same seed, they produce the same sequence. True random numbers require physical entropy sources (hardware noise). Most applications work fine with pseudo-random; cryptography needs CSPRNG.

How do I pick a random number between 1 and 100?

Use Math.floor(Math.random() × 100) + 1 in JavaScript. Math.random() gives [0,1); multiply by 100 gives [0,100); floor gives 0–99; add 1 gives 1–100. Our random number generator does this automatically for any range.

Related Calculators