Random Number Generator

Draw random whole numbers in any range: raffles, dice substitutes, classroom picks, sampling and quick decisions — with unique draws and sorting built in.

Result

—

About this calculator

A fair random draw is harder to improvise than it sounds — humans picking "random" numbers avoid repeats, favor the middle of the range and unconsciously pattern their choices. This generator uses your browser's pseudorandom generator, which has none of those biases: every integer in the range is equally likely on every draw, just like a well-run lottery machine.

The "no repeats" mode samples without replacement — each number can appear once, like dealing cards from a deck — and is the right choice for raffles, draft orders and picking distinct winners. Repeats-allowed mode behaves like rolling dice: independent draws where duplicates are natural and expected.

How to use it

  1. Set the minimum and maximum of your range (both are included).
  2. Choose how many numbers to draw, and whether repeats are allowed.
  3. Every input change draws fresh numbers — or press Calculate to draw again.

The formula

Number = min + floor(random × (max − min + 1)), where random ∈ [0, 1)

Scaling a uniform random value by the size of the range and flooring gives every integer an equal share of outcomes. Unique draws repeat the process while discarding duplicates (equivalent to drawing from a shrinking pool), which is why the count can never exceed the size of the range in that mode.

Worked example

A classroom raffle: minimum 1, maximum 30 (students), draw 3, no repeats — three distinct seat numbers, fairly chosen. A board-game substitute: minimum 1, maximum 6, draw 2, repeats allowed — a pair of dice, where doubles can and should sometimes appear (about one roll in six).

Frequently asked questions

Are these numbers really random?

They are pseudorandom: produced by a deterministic algorithm in your browser (the same Math.random used across the web) seeded from unpredictable system state. For raffles, games, sampling and decisions they are effectively random and unbiased. They are not suitable for cryptography or anything security-critical, where a dedicated cryptographic generator is required.

Why did I get the same number twice with repeats allowed?

Because independence allows it — and true randomness produces duplicates more often than intuition expects. In 5 draws from 1–100, the chance of at least one repeat is about 9.7%; from a small range like 1–6, repeats are the norm. If duplicates would look suspicious in your use case (a raffle), use the no-repeats mode.

Can I generate random decimals or negative numbers?

Negative numbers work fine — set a negative minimum (for example −50 to 50). For decimals, generate integers in a scaled range and place the decimal point yourself: for two decimal places between 0 and 10, draw from 0 to 1000 and divide by 100.

How many numbers can I draw at once?

Up to 1,000 per draw. In no-repeats mode the count also cannot exceed the size of the range — drawing 10 unique numbers requires a range of at least 10 values. The average of the draw is shown as a sanity check: over many draws it should hover near the middle of the range.