🎲 Random Number Generator
Generate a random number between any two values. Useful for games, decisions, and random sampling.
Enter Your Values
What is a Random Number Generator Used For?
A random number generator (RNG) picks a number from a defined range with equal probability for every number in that range. This calculator uses JavaScript's built-in Math.random() function, which generates a pseudorandom number uniformly distributed between your minimum and maximum values (both inclusive).
Games and decision-making are the most immediate uses. If you're playing a board game without a die, settling a friendly argument, or deciding who picks the restaurant, an RNG gives an impartial result instantly. Set the range to 1–6 to simulate a standard die, 1–2 for a coin flip, or any custom range for your game rules.
Raffles and giveaways are another common application. If you have a numbered list of entrants, a random number generator picks the winner fairly. Assign each entrant a number, set the range to match, and draw. For multiple winners, simply generate again (and exclude previously drawn numbers).
Research and sampling: when you need a random sample from a population (e.g., selecting 10 students from a class of 40 for a survey), an RNG gives you unbiased selections. Number each item, then generate enough random numbers to fill your sample size.
Passwords and security: while this tool isn't designed for cryptographic security, it can generate a random number that you use as part of a PIN or in a seed phrase. For proper secure passwords, use the Password Generator on CalForge instead.
How Random Number Generators Work
A random number generator (RNG) produces numbers with no predictable pattern within a specified range. This generator uses your browser's built-in cryptographic RNG (window.crypto), which produces numbers of sufficient randomness for games, decisions, giveaways, and sampling.
True randomness in computing is generated from physical entropy sources (hardware noise, timing variation). Pseudorandom generators use mathematical formulas seeded from these sources. For everyday use — picking a winner, assigning a number, making a decision — both produce results that are effectively random.