Random Number Generator

The random number generator creates truly unpredictable numbers within any range you define. Whether you need one number or hundreds — for lotteries, board games, statistical sampling, classroom activities, or coding tests — this free tool delivers instant, unbiased results.

What this calculator does

Choose your minimum and maximum values, set how many numbers to generate, and optionally enable 'unique' mode to prevent repetition. Unique mode is essential for lottery draws — every number appears only once.

When to use this calculator

This tool is most valuable when you need a result to compare against something else: a quoted figure, a competing option, or a budget threshold. Accurate comparisons require accurate inputs and arithmetic — this calculator ensures both.

Common mistakes

Many errors with this type of calculation stem from unit inconsistency: mixing metric and imperial, or mixing annual and monthly rates. Ensure all inputs use the same unit system before running the calculation.

Real-world scenarios

A shopper sees two versions of the same product at different prices: one at £14.50 for 400g and another at £11.99 for 300g. Running both price-per-gram calculations reveals the larger pack is 7% cheaper per unit — the kind of comparison that is impossible to do reliably in your head at the shelf.

Formula

Random Integer Formula

Random Int = Math.floor(Math.random() × (max − min + 1)) + min

Generates a uniformly distributed integer in the range [min, max]. For unique numbers, each result is removed from the pool before the next is drawn.

Worked example

Pick 6 unique lottery numbers between 1 and 49.

  1. Set min = 1, max = 49, count = 6, unique = ON
  2. Click Generate

Result: Example output: 3, 17, 22, 31, 43, 48 (uniformly random, no repeats)

Frequently asked questions

Are the numbers truly random?

They use JavaScript's Math.random() which generates pseudo-random numbers — statistically uniform and sufficient for all practical purposes except cryptographic security.

Can I generate unique lottery numbers?

Yes. Enable the 'unique' option and set count to 6, range 1–49 for UK Lotto, or 1–70 for Mega Millions main numbers.

CalcPlanet – Free Online Calculators

725+ free calculators and 108 tools for math, money, health, and everyday life. Instant results, verified formulas, no sign-up.

· Reviewed against our Editorial Standards and Formula Sources.

CalcPlanet calculators are free, privacy-first, and formula-reviewed.

Editorial Standards · Formula Sources · Privacy · Terms · Contact