BestCalculator .app

Random Number Generator

Pick whole numbers from a minimum to a maximum. Set how many, and whether repeats are allowed.

Minimum The smallest whole number that can appear. Negatives are allowed.
Maximum The largest whole number that can appear, included.
Quantity How many numbers to draw, from 1 to 1,000.
Repeats Repeats lets the same integer appear more than once. Unique draws each integer at most once.

Smart Tips

• Both ends are included. A minimum of 1 and a maximum of 6 can return 1 and can return 6.

• Choose Unique when you need a sample without replacement. The quantity cannot exceed the width of the range.

• This is not a lottery picker and it does not simulate dice faces or a deck of cards.

• The range can hold at most 4,294,967,296 integers. Wider ranges are rejected.

The Formula

offset = reject(uint32) mod (max − min + 1)

span Integers in the range
max − min + 1
threshold Rejected leftovers
2³² mod span
uint32 Random word
crypto.getRandomValues, or Math.random
result One draw
min + accepted offset

A 32-bit word below the threshold is thrown away and another word is drawn. Every integer from the minimum through the maximum is then equally likely.

Key Insights

No modulo bias

A plain remainder favors some leftovers when the span does not divide 2³². Rejection removes that bias.

Repeats are a choice

Independent draws may repeat. Unique draws skip a number that has already appeared.

Browser randomness

crypto.getRandomValues is used when the browser has it. Math.random is the fallback, and the same rejection step still runs.

A fixed cap

Quantity stops at 1,000 so a single click cannot ask for an endless list.

Frequently Asked Questions

Responsive Ad Space
-
Enter values to calculate
-
-

Note:Each accepted draw is equally likely inside the inclusive range. Rejected random words are not part of the result. This is not a lottery, a dice roller, or a source of passwords.

Responsive Ad Space