Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


gives a pseudorandom prime number in the range to .

gives a pseudorandom prime number in the range 2 to .

gives a list of n pseudorandom primes.


  • 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.
Introduced in 2007