Random prime generator

Prime Number Options

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.