Random Number Generator
Cryptographically secure random numbers using crypto.getRandomValues. Dice roller, coin flipper, and lottery picker included.
How to Use the Random Number Generator
- Choose a mode — Numbers, Dice Roller, Coin Flipper, or Lottery Picker using the tabs above.
- Configure the settings — set your range, count, decimals, and unique options.
- Click Generate (or Roll/Flip/Pick for the specialized modes).
- View, copy, or download the results. A histogram shows the distribution when generating many numbers.
Why Use crypto.getRandomValues Instead of Math.random()?
JavaScript's built-in Math.random() is a pseudo-random number generator (PRNG) — it uses a deterministic algorithm that only approximates randomness. While fine for games, it's not suitable for security-sensitive tasks. This tool uses the Web Crypto API's crypto.getRandomValues(), which draws entropy from your operating system's cryptographically secure random source. This is the same source used to generate SSL certificates, encryption keys, and secure tokens. The numbers produced are statistically indistinguishable from true randomness.
Random Numbers Mode
Generate between 1 and 1,000 random numbers in any range, with any number of decimal places. Enable Unique mode to ensure no number appears twice — useful for drawing lots, sampling without replacement, or creating randomized test datasets. The distribution histogram makes it easy to verify uniformity across your range.
Dice Roller
Supports all standard tabletop RPG dice: d4, d6, d8, d10, d12, and d20. Roll up to 20 dice simultaneously. Each roll is independent and uses cryptographic randomness, so results are far more unpredictable than physical dice in practice. Useful for tabletop RPGs, board games, and classroom probability demonstrations.
Coin Flipper
Flip a fair coin one to 100 times. Results show heads and tails counts with percentages. Over a large number of flips, you'll see the distribution converge toward 50/50, demonstrating the law of large numbers in action.
Lottery Number Picker
Pick a set of unique numbers from any range — mimic popular lotteries like Powerball (5 from 1–69), EuroMillions (5 from 1–50), or create a custom draw. Numbers are always unique (no repeats) and drawn without replacement, exactly like a real lottery machine. For more mathematical analysis of your results, try the Statistics Calculator.