Random Number Generator

Cryptographically secure random numbers using crypto.getRandomValues. Dice roller, coin flipper, and lottery picker included.

Click Generate to create random numbers.
Configure options and click Generate.

How to Use the Random Number Generator

  1. Choose a mode — Numbers, Dice Roller, Coin Flipper, or Lottery Picker using the tabs above.
  2. Configure the settings — set your range, count, decimals, and unique options.
  3. Click Generate (or Roll/Flip/Pick for the specialized modes).
  4. 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.

Frequently Asked Questions

Yes. This tool uses the Web Crypto API (crypto.getRandomValues) which generates cryptographically secure random numbers. This is the same randomness source used for security keys and tokens, making it far more random than Math.random().
Non-unique mode allows the same number to appear multiple times. Unique mode ensures each number in the list appears only once, like drawing lottery balls without replacement. Unique mode requires the range to be large enough to contain the requested count.
The dice roller supports standard tabletop RPG dice: d4, d6, d8, d10, d12, and d20. Each roll uses crypto.getRandomValues for true randomness. You can roll multiple dice at once and see each individual result plus the total.
The lottery picker selects a set of unique numbers from a specified range, simulating a lottery draw. For example, picking 6 numbers from 1–49 mimics a standard lottery. Numbers are selected without replacement, ensuring no duplicates.
The histogram groups your generated numbers into equal-width bins and shows the frequency of numbers falling into each range. A uniform distribution should produce bars of roughly equal height, confirming the randomness of the generator.