RandomNr

Number Lists

Random Prime Number Generator

Draw random prime numbers from a range you choose, checked with a proper primality test.

Random Prime Number Generator

73

Random prime from 1 to 100 · 1 result

Choose the range

How many primes to generate

Up to 1000 per draw

Options

Sort results
Copy separator

How to use the random prime generator

  1. Set the range, or tap a preset such as 3 digit primes.
  2. Choose how many primes to draw, with no repeats if each must differ.
  3. Press Generate random primes, then copy or export.

How big the prime pool is

The draw is uniform across every prime in your range, so the pool size sets the odds of any particular prime appearing. These are the pools behind the common settings.

RangePrimes in the pool
1 to 10025
1 to 1,000168
3 digit (100 to 999)143
4 digit (1,000 to 9,999)1,061
1 to 10,0001,229

Because the tool enumerates the pool before drawing, every prime in it is exactly equally likely, which a test random numbers until one is prime loop does not guarantee across the range.

The chance a random number is prime

Primes thin out on a precise schedule: near a number n, roughly one number in every natural log of n is prime. Around 100 that is about one in five, around 1,000 one in seven, and around a million only one in fourteen. It is why the 4 digit pool holds 1,061 primes while the 3 digit pool, a tenth the width, still holds 143.

Why random primes matter

Random primes are the raw material of modern cryptography. RSA keys are built from a pair of large random primes, each hundreds of digits long for a 2048 bit key, and the security rests on how hard it is to recover them from their product. The primes this page draws are teaching sized cousins of those, ideal for demonstrating key generation, modular arithmetic exercises and hashing examples. For the full ordered list rather than a draw, see the prime number list.

Popular generators

Frequently asked questions

How does it pick a random prime

It finds every prime in your range, then draws from that set at random with the browser cryptographic random source, so each prime is equally likely.

What range can I use

Any range up to two million. If there are no primes in the range, for example 24 to 28, the tool says so.

Can I draw several unique primes

Yes. Tick no repeats and each prime in the set is different, capped at how many primes the range holds.

Are the primes verified

Yes. Each candidate is confirmed by trial division up to its square root before it can be drawn.

Is it free

Yes, free and with no sign up. Every draw runs in your browser and nothing you enter leaves your device.

Related generators

Want the full list rather than a draw? Use the prime number list generator. For any whole number draw see the random number generator.