Random Number Generator

–

History

Your results will appear here. Tap Use on any of them to carry it into the next calculation, in this calculator or another one. History is kept while this tab is open.

Enter the smallest number as Min and the largest as Max, then press Generate: the random number generator picks an integer from that range, and every one, both ends included, is equally likely. Set How many for several numbers, with or without repeats.

How the numbers are generated

Each whole number from Min to Max has the same chance of coming up:

chance of each number = 1 ÷ (Max − Min + 1)

From 1 to 100 that's 1 ÷ 100, or 1% per number.

The numbers come from your browser's cryptographic generator, crypto.getRandomValues in the Web Crypto API. The W3C standard requires a cryptographically strong pseudo-random number generator, seeded with entropy from your device. Pseudo-random means an algorithm produces the numbers. A true random number generator measures a physical process instead, such as electrical noise. To fit the output to your range without favoring some numbers, the generator throws away values that would skew it and draws again.

It all happens in your browser, and the numbers you enter are not sent anywhere. The fields start at 1 and 100, so pressing Generate right away gives you a number.

Several numbers, with or without repeats

Set How many to get up to 1 000 numbers at once. They come as a list in the order they were drawn, with the sum underneath. Sort puts the list in ascending order; Unsort restores the draw order.

Tick No repeats for a list without duplicates. Each number then appears at most once, so the list can't be longer than the range: 1 to 10 holds 10 unique numbers, and asking for 11 gives an error. To find the mean of your list, send it to the average calculator with Use.

Examples

The numbers change every time, so each row shows what always holds for that setting.

You enterResult
1 to 100, How many 1One number from 1 to 100, no Sum line
1 to 100, How many 3, No repeatsFor example 7, 42, 86 · Sum 135
1 to 3, How many 3, No repeats1, 2, 3 after Sort · Sum 6
1 to 10, How many 10, No repeats1, 2, …, 10 after Sort · Sum 55
−2 to 2, How many 5, No repeats−2, −1, 0, 1, 2 after Sort · Sum 0
1 to 1 000, How many 1 000, No repeatsEvery number from 1 to 1 000 once · Sum 500 500
1 to 2, How many 3Three numbers, each 1 or 2 · Sum 3 to 6
1 to 10, How many 11, No repeatsOnly 10 unique numbers fit this range
Min 5, Max 5Min must be less than Max

For other everyday math, the online calculator is on the home page.

FAQ

How do random number generators work?

An algorithm starts from an initial state, the seed, and produces a sequence of numbers spread evenly across the range. Here that algorithm is your browser's cryptographic generator, described under How the numbers are generated.

How can I choose a random number between 1 and 10?

Enter 1 as Min and 10 as Max, then press Generate. Each number from 1 to 10 has a 10% chance: 1 ÷ 10.

What is meant by random number?

It's a number chosen so that nobody can predict it in advance, and every value in the range has the same chance. You can't tell from a single number whether it's random; only the way it was chosen tells you that.

Is this generator truly random?

No. It's a pseudo-random number generator, though a cryptographic-grade one built into your browser. For games, deciding turns in class or picking a sample, that's enough. A true random number generator takes its numbers from a physical source, such as electrical noise.

Can I generate random numbers without repeats?

Yes: tick No repeats before you press Generate. The list can't be longer than the range, so asking for 3 numbers from 1 to 2 gives the error Only 2 unique numbers fit this range.