Random Number Generator CalculatorScale.com
Cryptography & Math Web Crypto API Entropy

Random Number Generator

Generate true cryptographically secure random integers or decimals with support for arbitrary precision up to 999 digits, batch generation, unique sampling, and custom sorting.

1Simple Random Number Generator

This version of the generator creates a random integer. It can deal with very large integers up to a few thousand digits.

Quick Ranges:

2Comprehensive Random Number Generator

This version of the generator can create one or many random integers or decimals. It can deal with very large numbers with up to 999 digits of precision.

1. Range Bounds
1
2. Number Type & Precision
50 digits
Duplicate Handling:
Sort Output:

Comprehensive Guide to Random Number Generation (RNG) & Cryptography

A Random Number Generator (RNG) is a computational or physical system designed to generate a sequence of numbers or symbols that lack any discernible pattern, exhibiting statistical randomness.

True Random Number Generators (TRNG)

Extracts entropy from physical, non-deterministic environmental phenomena such as thermal noise, radioactive decay, or atmospheric noise. They cannot be reproduced even if starting conditions are known.

Cryptographically Secure PRNG (CSPRNG)

Uses mathematical algorithms seeded with high-entropy OS noise (via crypto.getRandomValues()). Designed to make future output computationally impossible to predict from past outputs.

Uniform Distribution & Rejection Sampling

To avoid modulo bias when sampling integers in a non-power-of-two range [0, M], modern generators discard raw random bitstreams that fall above the largest multiple of the range and redraw. This ensures every candidate number has an exact, uniform probability of selection:

P(X = k) = 1 / (Upper - Lower + 1)

Frequently Asked Questions

How does this calculator generate high-precision decimals up to 999 digits?

Standard JavaScript floats are limited to 64-bit IEEE-754 precision (~15-17 significant digits). This calculator scales the bounds to arbitrary BigInt integers at the requested precision, samples random bitstreams cryptographically, and formats the result with exact string decimal placement without precision loss.

What makes window.crypto.getRandomValues() better than Math.random()?

Math.random() uses a standard PRNG (like xoshiro128**) which is not cryptographically secure and exhibits predictable state trajectories. The Web Crypto API taps into system-level entropy pools, providing uniform distribution suitable for security and unbiased statistical sampling.

How does the unique numbers (no duplicates) mode work?

The engine tracks previously chosen values in a Hash Set and redraws if a collision occurs. If the requested count exceeds the total number of integers in the specified range, the calculator immediately halts with a helpful validation message.

What is modulo bias in random number generation?

Modulo bias occurs when a random number generator that produces a large range (e.g. 0 to 255) maps values to a smaller range (e.g. 0 to 10) using simple modulo arithmetic (rand % 10). Because 256 is not evenly divisible by 10, lower numbers have a higher chance of being picked. Rejection sampling completely eliminates this bias.