Random Prime Number Generator
Generates a random prime number within a range you set (up to 1,000,000). Every prime in range has an equal chance of being picked.
What this generator does
Picks a prime number at random from within a range you set. A prime has exactly two distinct divisors, itself and one, which is why the results thin out as the numbers get larger.
How to use this tool
- Set a minimum and maximum.
- Press generate for a random prime in that range.
- Generate again for a different prime.
Worked examples
- Examples
- 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 — the primes below 30
Common use cases
- Maths teaching and homework examples
- Picking a prime for a coding exercise
- Cryptography/number-theory demonstrations
Limitations and good to know
- Primes are not evenly spaced, so a wide range does not produce evenly spread results. The tool draws uniformly from the primes it finds, not from the number line.
Related generators
- Random Number GeneratorGenerate one or many random numbers within any range, with optional duplicate control and sorting.
- Toy RSA Key GeneratorBuilds a tiny RSA key from two small primes and checks that every message in the modulus survives being encrypted and decrypted.
- Prime Gap GeneratorRuns of consecutive primes with the gap after each, twin pairs highlighted and every gap proved to contain no prime.
- Modular Arithmetic Question GeneratorRemainders, modular powers by repeated squaring, and inverses that only exist when the values are coprime.
- Random Binary Number GeneratorA number shown in binary, alongside its decimal value for reference.