Random Number Generator

Generate random numbers between any minimum and maximum value using a uniform distribution. Set the range, choose how many numbers to generate, and select integers or decimals. Each click produces a new set of independent, uniformly distributed values.

Quick Answer

Generating 1 random integer between 1 and 100 might return 42, 87, or 7. Every integer in the range has an equal probability of 1/100 = 1%.

Common Examples

Input Result
1 to 100, 1 integer A single random integer like 42
1 to 6, 2 integers Two dice rolls like 3, 5
1 to 10, 5 integers Five values like 7, 2, 9, 1, 4
0 to 1, 3 decimals Three values like 0.4821, 0.1037, 0.9254

How It Works

The formula

For a random integer between min and max (inclusive):

n = floor(random() x (max - min + 1)) + min

Where random() produces a uniform value in [0, 1). The floor function and +1 ensure both endpoints are included with equal probability.

For a random decimal between min and max:

n = random() x (max - min) + min

This produces a uniformly distributed value anywhere in the continuous range [min, max).

Uniform distribution

Every value in the range has equal probability. For integers between 1 and 6, each number has a 1/6 (16.67%) chance of appearing. For integers between 1 and 100, each has a 1/100 (1%) chance. Over many trials, the frequency of each value converges toward this theoretical probability.

Pseudorandom numbers

Computers generate pseudorandom numbers using deterministic algorithms seeded with unpredictable values (system time, hardware entropy). The results pass statistical tests for randomness and are suitable for simulations, games, sampling, and general-purpose use. They are not suitable for cryptographic applications, which require a cryptographically secure random number generator (CSPRNG).

Worked example

To generate a random integer between 1 and 6 (simulating a die roll): random() returns, say, 0.7234. Multiply by (6 - 1 + 1) = 6 to get 4.3404. Floor that to 4, then add 1 to get 5. The result is 5, a valid die roll.

Related Calculators

Frequently Asked Questions

Are the generated numbers truly random?
They are pseudorandom, generated by a deterministic algorithm that produces values statistically indistinguishable from true randomness for general purposes. They are suitable for games, simulations, and sampling but not for cryptographic security.
Can I generate negative random numbers?
Yes. Set the minimum to a negative value. For example, setting the range to -50 to 50 generates random numbers that can be negative, zero, or positive.
What is the maximum number of values I can generate at once?
This generator supports up to 10,000 numbers in a single batch. For most uses, smaller batches of 1 to 100 are typical.
Is each number independent?
Yes. Each generated number is independent of the others. Generating a 6 does not affect the probability of the next number being a 6.
Can I use this for lottery numbers?
You can use it to generate random numbers in a lottery range, but the results carry no predictive value. Lottery drawings use physical random processes, not computer algorithms, and past results do not affect future drawings.