Thousands of tools! Check out Online Tools – I have now added thousands of tools.

I often have to generate random prime numbers so I created this simple utility that does it for me. It lets you generate as many random primes as you need from the given range. It works in the browser and is powered by alien technology from the future.

Random Prime Generator Options

Random Prime Range
Count and Separator
Random Primes Base

Random Prime Generator Examples (click to try!)

Ten Random Primes
This example generates ten random prime numbers, from the range starting at 2 and ending at 100.
23
7
19
97
79
53
59
3
89
29
Generate this many random prime numbers.
Starting value.
Ending value.
Use this symbol to separate output values.
Decimal Base
Seven-digit Prime Numbers
In this example, we create a random list of 20 seven-digit primes, separated by a comma. The search range starts with a million and ends at two million.
1453369, 1438169, 1770679, 1450103, 1767397, 1156171, 1306597, 1950449, 1842941, 1662553, 1637521, 1018177, 1569181, 1924547, 1978589, 1543429, 1396103, 1247527, 1811647, 1798631
Generate this many random prime numbers.
Starting value.
Ending value.
Use this symbol to separate output values.
Decimal Base
Random Binary Primes
In this example, we set the output base to binary (base 2) and generate six random binary primes from the range 2 to 50.
10111
101111
10
11
11111
10001
Generate this many random prime numbers.
Starting value.
Ending value.
Use this symbol to separate output values.
Binary Base

How Does This Random Prime Generator Work?

This random prime number generator works entirely in your browser and is written in JavaScript. First, it generates a list of possible prime values starting from start and ending with end (range values specified in options). These are all numbers that are not divisible by 2 or 3. Then, it uses the Math.random() function to select random values from this list and calls the isPrime() function to check whether this number is actually a prime. It repeats this process until the output list has as many primes as you specified in the count option. Finally, it uses the join() function to separate all randomly selected primes by the specified separator character in options.

Created by Browserling

This random prime generator was created by me and my team at Browserling. Behind the scenes, it's actually powered by our web developer tools that are used by millions of people every month. Browserling itself is an online cross-browser testing service powered by alien technology. Check it out!

Secret message: If you love my tools, then I love you, too! Use coupon code TOOLLING to get a discount at my company.