Random Number Generator

How do I generate a random number?

How it is calculated

Each number is drawn independently and uniformly from the whole numbers between min and max, both included, using PHP's random_int, which relies on the operating system's secure random source. With a range of n = max − min + 1 values, every value has probability 1 ÷ n on each draw. Min and max are cut down to whole numbers (3.9 becomes 3), and min must not exceed max or there is no result. count is the number of draws; it defaults to 1 and is limited to 1–100. Draws are independent, so the same number can appear more than once in a list. Every run gives a new result.

Worked example

Sample run on 2026-10-17 with min 1, max 49 and count 6. The tool returned 21, 22, 20, 28, 42, 31. Each draw had a 1 in 49 chance for every value, about 2.04%. The next run produces a different list. If you need six different numbers, as in a lottery pick, check the list for repeats and draw again if any appear.

Try this example →

Common mistakes

  • Expecting a list without repeats. Draws are independent, so duplicates are normal, and the tool does not shuffle a fixed set.
  • Entering decimals such as 0.5 to 1.5 for a decimal result. The tool works on whole numbers only and truncates the fractions.
  • Expecting the maximum to be excluded. Both the minimum and the maximum can appear.
  • Setting min higher than max, which gives no result.
  • Reading a short streak, such as three low numbers in a row, as a sign the generator is biased. Random sequences naturally contain streaks.

About this calculator

This tool generates one or more random integers uniformly distributed between a minimum and maximum value you set, meaning every number in that range has an equal chance of being picked, with no bias toward any particular value. It can produce a single number or a batch at once, useful whenever multiple independent picks are needed in one go.

It is used for drawing raffle winners, assigning random group numbers or seating for classes and events, rolling for tabletop games, and picking a random sample index for surveys or statistical checks. Developers also use quick random number generation like this to spot-check logic or generate placeholder test data without writing a script.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators