Skip to content
Toolcroft

Random Generators

Random Number Generator

Generate random integers or decimals within any range. Set count up to 10,000, allow or exclude duplicates, and sort the output. All randomness uses the Web Crypto API - never Math.random.

Configure the options above and click Generate.

How random numbers are generated

Every number on this page is produced by crypto.getRandomValues: the browser's built-in cryptographically secure random number generator. It is seeded by the operating system's entropy pool (hardware events, timing jitter, etc.), making it suitable for simulations, games, raffles, and anything requiring high-quality randomness.

Rejection sampling is used to eliminate modulo bias. Naïvely using randomValue % range slightly favors some outputs when range doesn't evenly divide the generator's output space. The rejection approach re-draws any value that would introduce bias, guaranteeing a perfectly flat distribution across the range.

Common use cases

  • Pick a random winner: assign each entrant a number, generate one random integer in that range.
  • Simulate a die roll: set min = 1, max = 6 (or 20 for a d20).
  • Sample items from a list: generate unique integers in [1, list length] with duplicates disabled.
  • Monte Carlo simulations: generate large batches of decimals in [0, 1] with high decimal precision.
  • Random lottery picks: generate unique integers in your lottery's range, sorted ascending.

Integer vs decimal mode

Set Decimal places to 0 for whole numbers. Any value from 1–10 switches to decimal mode. For example, min = 0, max = 1, decimals = 4 produces values like 0.3821: useful for probability sampling or random weights.

The range is always inclusive on both ends: min and max can both appear in the output.

Statistical distributions

This tool generates numbers from a uniform distribution: every value in the range is equally likely. Many real-world simulations require non-uniform distributions:

  • Normal (Gaussian) distribution: bell curve centered on a mean; used in Monte Carlo simulations, manufacturing tolerances, and statistical modeling. Not available here — use a statistics tool or the Box-Muller transform in your own code.
  • Exponential distribution: models time between random events (e.g., server request intervals).
  • Binomial distribution: models the number of successes in n independent trials.

Batch mode and unique numbers

The no duplicates option implements sampling without replacement: once a number is drawn it is removed from the pool, so the same value cannot appear twice. This is the correct model for lottery draws, random seat assignments, and anything where each item can only be selected once. With duplicates allowed (the default), each draw is independent (sampling with replacement).