This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)


RandomPrime[{imin, imax}]
gives a pseudorandom prime number in the range imin to imax.
gives a pseudorandom prime number in the range 2 to imax.
RandomPrime[range, n]
gives a list of n pseudorandom primes.
  • A random prime p 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 imin and imax with equal probability.
  • RandomPrime[range, {n1, n2, ...}] gives a n_1×n_2×… array of primes.
New in 6