# Random Number Generator

Generate random numbers within a custom minimum and maximum range instantly with this free online random number generator.

---

- **Canonical URL:** https://dothecalculation.com/calculators/random-number-calculator
- **Category:** Math calculators
- **Publisher:** Do The Calculation (https://dothecalculation.com)
- **Cost:** Free, no account or sign-up required
- **Privacy:** Runs entirely in the browser; inputs are never sent to a server
- **Methodology:** https://dothecalculation.com/methodology
- **Reviewed by:** Dr. Arthur Pendelton, PhD, PhD in Mathematical Statistics, Cambridge University (https://dothecalculation.com/about/team/arthur-pendelton)

---

## Generate pseudo-random sequences

Generate up to 20 pseudo-random numbers in a custom range. Reuse the same seed to reproduce the exact same sequence every time.

- Custom min/max range
- Deterministic seed control
- Repeatable outcomes

## Deterministic Random Number Generation

True physical randomness is difficult to generate computationally, so systems use mathematical algorithms to produce pseudo-random numbers. These numbers appear random but are determined by an initial value called a seed.

Using a seed is highly valuable because it makes the random sequence repeatable. This is essential for testing algorithms, replicating scientific experiments, or sharing specific random results with others.

The core mapping formula is:

$$\text{Value} = \text{Min} + \text{Ratio} \times (\text{Max} - \text{Min})$$

## Pseudorandom Number Algorithms

This calculator uses a Lehmer-style linear congruential generator, the Park-Miller "minimal standard" (multiplier 48271, modulus \(2^{31}-1\)). Each call advances an internal state register with modular multiplication and converts the result to a value between 0 and 1 before mapping it into your range. Starting from the identical seed replays the exact same sequence of internal states, which is what makes the output reproducible.

This is the same family of algorithm behind most standard generators (Linear Congruential Generators and, in more modern libraries, PCG or Mersenne Twister). All of them trade true unpredictability for speed and reproducibility.

## How to Use This Calculator

Enter a minimum, a maximum, how many numbers to generate (up to 20 per run), and a seed. The calculator runs the seeded generator and maps each output into your range as a rounded integer — using the same min, max, count, and seed always reproduces the same sequence.

Because each draw is independent and mapped straight from the generator's internal state, numbers can repeat within a single run, especially with a small range or a high count. This tool draws *with* replacement — it does not remove a value from the pool once it's been generated, so it isn't a substitute for a no-repeat shuffle (like drawing raffle tickets without putting them back).

## Worked Example: Min 1, Max 100, Count 5, Seed 42

With the calculator's default settings, this seed produces the repeatable sequence:

$$1, \; 58, \; 26, \; 45, \; 66$$

Re-running the calculator with the same min, max, count, and seed always reproduces this exact sequence — that's what makes it useful for repeatable tests and shareable examples.

## Real-World Uses for Seeded Random Numbers

A reproducible generator is useful anywhere you need randomness that someone else can verify or replay: assigning participants to A/B test groups, picking a random sample of rows to audit from a larger dataset, generating realistic test or demo data, running Monte Carlo simulations where you need to rerun the exact same trial, or setting up games, raffles, and classroom drawings where you want to be able to prove and repeat the draw.

If you need *unpredictable* numbers instead — a lottery drawing, a security token, a coin flip nobody could have predicted — a seeded PRNG is the wrong tool. Use a cryptographically secure source (like your OS's random device) instead of this one.

## Related Calculators

To compute the mean and spread of a generated sample, use the [standard deviation calculator](/calculators/standard-deviation-calculator). For modeling a sampling process as a probability distribution, see the [binomial distribution calculator](/calculators/binomial-distribution-calculator).

## Frequently asked questions

### Why does the seed make numbers repeatable?

The pseudo-random number generator uses a mathematical formula where each number is computed from the previous one. Starting with the same seed ensures the sequence of formulas begins at the exact same point.

### How is the range applied?

The generator produces a ratio between 0 and 1, which is then mapped into your min/max range and rounded to the nearest integer: Value = Min + Ratio × (Max − Min).

### Can the same number appear more than once in a run?

Yes. Each number is drawn independently, with replacement, so repeats are possible — especially with a small range or a high count. If you need a no-repeat draw (like a raffle), treat any duplicates as re-draws.

### What is a PRNG?

PRNG stands for Pseudo-Random Number Generator. It is an algorithm that generates a sequence of numbers approximating the properties of random numbers.

### What is the difference between pseudo-random and true random?

Pseudo-random numbers are generated by a deterministic algorithm and are repeatable. True random numbers are generated from physical processes (like atmospheric noise or radioactive decay) and are completely unpredictable.

### Can I use this for cryptography?

No. Standard PRNGs are not cryptographically secure (CSPRNG). If an attacker knows the algorithm and seed, they can predict all future numbers. Cryptographic security requires high-entropy hardware seeds.

### How do I choose a seed?

Use any number or string. If you want a random seed, leave it blank or use the current timestamp (which changes millisecond-by-millisecond).

### What is a probability distribution?

A mathematical function that describes the likelihood of obtaining the possible values of a random variable (this generator uses a uniform distribution, where all numbers have equal probability).

### How does the generator handle decimals?

It returns a floating-point number. If you select the integer option, it truncates or rounds the value to the nearest whole integer.

### What is the period of a PRNG?

The period is the number of values the generator can produce before it begins repeating the exact same sequence of numbers.

### Are online randomizers truly random?

Most are pseudorandom, generated by a deterministic algorithm rather than a physical process. Even unseeded tools like a browser's Math.random() typically run on an algorithm such as xorshift128+ under the hood — fast and statistically well-distributed, but not a source of true entropy.

## Related concepts

- **Seed** — An initial value used to initialize a pseudo-random number generator.
- **Pseudo-random** — A sequence of numbers that approximates the properties of random numbers but is generated by a deterministic mathematical process.
- **Uniform Distribution** — A probability distribution where all outcomes are equally likely within a range.
- **Linear congruential generator** — A PRNG family that produces each new value from the previous one via modular multiplication — fast, simple, and fully reproducible from a seed.

## Related guides

- [Random Number Generation Guide: Seeded PRNGs, True Randomness, and Safe Use Cases](https://dothecalculation.com/blog/math/random-number-generation) — Learn the difference between deterministic seeded generators, browser pseudo-random functions, and cryptographically strong randomness so you can use the right tool for the job.
- [Standard Deviation Guide: Measure Data Spread Clearly](https://dothecalculation.com/blog/math/standard-deviation-explained) — Understand variance, population vs sample formulas, and data spread with worked examples tied to the live DTC standard deviation calculator.

## Related calculators

- [Prime Number Checker & List Generator](https://dothecalculation.com/calculators/prime-number-calculator) — Check primality, find the next prime, and generate prime numbers within a custom range using fast sieve methods instantly.
- [Password Generator](https://dothecalculation.com/calculators/password-calculator) — Generate strong, secure passwords instantly with custom length, symbols, numbers, and character rules, completely free to use.
- [Number Base Converter](https://dothecalculation.com/calculators/base-converter) — Convert whole numbers between binary, octal, decimal, and hexadecimal instantly, with positional-notation and successive-division proofs shown.
- [Complex Number & Phasor Calculator](https://dothecalculation.com/calculators/complex-number-calculator) — Add, subtract, multiply, divide, and find roots of complex numbers, with automatic rectangular-to-polar phasor conversion, using this free calculator.
- [Fibonacci & Golden Ratio Calculator](https://dothecalculation.com/calculators/fibonacci-golden-ratio-calculator) — Generate Fibonacci numbers, check sequence membership, and solve Golden Ratio proportions instantly with this free math calculator.
- [Rounding Calculator](https://dothecalculation.com/calculators/rounding-calculator) — Use our free rounding calculator to round numbers to any place value. Shows step-by-step work for nearest whole number, tenth, hundredth, and more.

---

_This calculator is for educational and planning purposes. Verify calculations manually for critical academic, professional, or scientific applications._

---

_Source: [Do The Calculation](https://dothecalculation.com/calculators/random-number-calculator). Quote freely with attribution and a link to this page._
