School · all ages

Random Number Generator

Integers, Decimals, Dice, Lottery & PIN Picks

Enter a minimum, maximum, and count to generate random integers or decimals within any range. Options include unique numbers, sorted output, and presets for dice rolls, lottery picks, and PINs. A seed makes results reproducible.

Use tool</> EmbedPress ⌘D / Ctrl+D to bookmark

Options

Configure your random numbers

How to Use the Random Number Generator

  1. Set Minimum and Maximum to define the range. Both bounds are inclusive.
  2. Set How many — any count from 1 to 10,000.
  3. Adjust Decimal places: 0 for integers, 1–10 for decimal output.
  4. Enable No duplicates to ensure each value appears at most once.
  5. Choose a Sort order to sort output ascending, descending, or leave in generation order.
  6. Click a preset for common configurations: dice rolls, lottery picks, or PINs.
  7. Click Generate, then copy or download the results.

How Random Number Generation Works

The default mode uses JavaScript's Math.random(), which returns a pseudo-random float uniformly distributed between 0 (inclusive) and 1 (exclusive). For integers, the formula is Math.floor(Math.random() × (max − min + 1)) + min. Both bounds are inclusive, so min and max can both appear in results.

For decimal output, the scaled value is rounded to the chosen decimal places using standard rounding (halfway rounds away from zero). Setting decimal places to 0 is equivalent to integer mode. The underlying PRNG is not cryptographically secure — it is well-suited for games, simulations, and statistics, but not for cryptographic keys or security tokens.

Unique Numbers and Duplicate Prevention

Enabling unique output ensures no value appears twice. For integer ranges up to 10,000 values wide, a Fisher-Yates shuffle is performed on the complete range array and the first N elements are selected. For larger ranges, rejection sampling draws one number at a time and discards duplicates. For decimal output, the formatted string (e.g. "3.14") is the uniqueness key. If the count exceeds available unique values, an error is returned.

Seeded Reproducible Results

A seed initialises a deterministic sequence using the mulberry32 algorithm. The same seed, range, and count always produce identical output — useful for classroom demonstrations, software testing, or sharing a specific random sequence. Changing any digit of the seed produces a completely different sequence. The seeded mode is not cryptographically secure.

FAQ

Random Number Generator Questions

Short answers for readers and answer engines.

Are the generated numbers truly random?

They are pseudo-random. JavaScript's Math.random() passes statistical tests but is not cryptographically secure. It is suitable for games, statistics, decisions, and simulations — not for cryptographic keys or security tokens.

Can I generate negative random numbers?

Yes. Set the minimum to a negative value — for example, −100 to 100 — and the generator covers the full range. Both bounds are inclusive.

What is a seed and why would I use one?

A seed initialises a deterministic sequence. The same seed, range, and count always produce identical output — useful for reproducible examples, testing, or sharing a specific set of numbers.

How does unique number generation work?

For integer ranges ≤ 10,000 values, a Fisher-Yates shuffle is applied and the first N elements are taken. For larger ranges, rejection sampling discards duplicates. If count exceeds available unique values, an error is shown.

What is the maximum count I can generate?

Up to 10,000 numbers per run. Integer generation completes quickly at any count. Unique decimals with high precision may take slightly longer due to rejection sampling.

Browse

Explore All Tools