# Wolfram Language & System 10.0 (2014)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

# RandomPrime

RandomPrime[{imin,imax}]
gives a pseudorandom prime number in the range to .

RandomPrime[imax]
gives a pseudorandom prime number in the range 2 to .

RandomPrime[range,n]
gives a list of n pseudorandom primes.

## DetailsDetails

• A random prime is computed by repeatedly generating pseudorandom integers in the specified range until the desired number of primes has been produced.
• If no prime exists in the specified range, the input is returned unevaluated with an error message.
• RandomPrime[{imin,imax}] chooses primes between and with equal probability.
• RandomPrime[imax] is equivalent to RandomPrime[{2,imax}].
• RandomPrime[range,{n1,n2,}] gives an ×× array of primes.

## ExamplesExamplesopen allclose all

### Basic Examples  (3)Basic Examples  (3)

A random prime less than 100:

 Out[1]=

A random 10-digit prime:

 Out[1]=

A list of 10 pseudorandom primes less than 100:

 Out[1]=

## TutorialsTutorials

Introduced in 2007
(6.0)