RNG — Random Number Generator
The three-letter version: a random number, right now.
RNG stands for random number generator, and in programming it usually means a pseudo-random one — a deterministic algorithm seeded once. The distinction matters: a seeded PRNG is fine for a game but wrong for anything security-adjacent.
This page uses the browser's cryptographic source, which is the honest answer to 'give me a random number' without a seeded state behind it. If you are looking for how to do this in code, the developer notes below cover the two common mistakes.
How to use it
- Set the bounds, or keep 1-100.
- Generate as many times as you like.
- For code, read the notes below before copying a snippet from elsewhere.
Two mistakes in almost every RNG snippet
First, `Math.floor(Math.random() * n) + 1` looks correct but uses a non-cryptographic PRNG, and for large ranges the multiplication loses precision. Second, `crypto.getRandomValues(buf); value % n` introduces modulo bias whenever n does not divide 2^32 — the first few values become slightly more likely.
The correct pattern is rejection sampling: draw a 32-bit value, discard it if it falls in the incomplete tail, and only then reduce modulo n. It costs an occasional re-draw and removes the bias entirely. In Python, `secrets.randbelow(n)` already does this; in JavaScript you have to write it yourself.
Reviewed 2026-10-21. This tool runs entirely in your browser — no server, no account, and nothing you generate is stored.
Frequently asked questions
What does RNG stand for?
Random number generator. A CSPRNG is the cryptographic variant, which draws from an OS entropy pool rather than a seeded formula.
Is this a true random number generator?
No — true randomness needs a physical entropy source. This is a cryptographically secure pseudo-random generator seeded by the OS, which is what browsers and servers use for TLS.
How do I get a random number in JavaScript?
Use crypto.getRandomValues with rejection sampling as described above. For non-security uses, Math.random() is acceptable but must not be used for tokens, passwords or anything an attacker benefits from predicting.
Related tools
More from Random numbers.