Random Prime Generator
Create reproducible lists of prime numbers sampled from a specified range. Control whether results are unique and how many primes to generate.
Also known as: prime numbers · prime picker
seeded
Presets
Output
About this tool, tips & examples
What it does
The Random Prime Generator samples prime numbers from any range you set (minimum 2, naturally), with unique or with-replacement draws, up to 1,000 primes per run. Primality is verified by trial division, and seeded output regenerates identically — a reproducible source of primes for teaching and testing.
Common use cases
- Math education — prime recognition drills, factorization exercises, and “is 91 prime?” discussion starters (it isn’t — 7×13).
- Algorithm testing — primes as inputs for factorization, GCD, and modular-arithmetic code (presets for small, medium, and large ranges).
- Hash table sizing examples — demonstrating why prime table sizes reduce clustering.
- Cryptography teaching — illustrating prime-based ideas at classroom scale (not key generation — see below).
Settings
- Minimum / Maximum — the sampling range (from 2 upward).
- Unique only — no repeated primes within a run, or allow replacement (a preset for each style).
- How many — 1 to 1,000 primes, exportable as text, CSV, or JSON.
- Seed — the same seed and range regenerate the identical primes.
Privacy note
Primes are computed locally in your browser; nothing is uploaded. Not for cryptographic key generation: these are seeded, reproducible, classroom-scale primes — real crypto needs secret primes hundreds of digits long from vetted libraries.
FAQ
How rare are primes in my range? Roughly 1 in ln(n) numbers near n is prime — about 1 in 7 near 1,000, 1 in 23 near 10 billion. Watching the density thin out is a lesson in itself.
Why can’t I use these for RSA? Three reasons: they’re far too small, they’re reproducible from the seed, and proper key generation has additional requirements. Use a cryptographic library; use this to explain RSA.
What if my range contains few primes? Unique mode can only return the primes that exist there — a narrow range high up may have fewer primes than you requested.