---
name: "Math::Prime::Util::RandomPrimes"
section: "3pm"
platform: "linux"
package: "libmath-prime-util-perl"
version: "0.73-2+b5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Math::Prime::Util::RandomPrimes"
---

# Math::Prime::Util::RandomPrimes(3pm)

Generate random primes

## NAME

Math::Prime::Util::RandomPrimes - Generate random primes

## VERSION

Version 0.73

## SYNOPSIS

## DESCRIPTION

Routines to generate random primes, including constructing proven primes.

## RANDOM PRIME FUNCTIONS

### random\_prime

Generate a random prime between `"low"` and `"high"`.  If given one argument, `"low"` will be 2.

### random\_ndigit\_prime

Generate a random prime with `"n"` digits.  `"n"` must be at least 1.

### random\_nbit\_prime

Generate a random prime with `"n"` bits.  `"n"` must be at least 2.

### random\_maurer\_prime

Construct a random provable prime of `"n"` bits using Maurer's FastPrime algorithm.  `"n"` must be at least 2.

### random\_maurer\_prime\_with\_cert

Construct a random provable prime of `"n"` bits using Maurer's FastPrime algorithm.  `"n"` must be at least 2.  Returns a list of two items: the prime and the certificate.

### random\_shawe\_taylor\_prime

Construct a random provable prime of `"n"` bits using Shawe-Taylor's algorithm.  `"n"` must be at least 2.  The implementation is from FIPS 186-4 and uses SHA-256 with 512 bits of randomness.

### random\_shawe\_taylor\_prime\_with\_cert

Construct a random provable prime of `"n"` bits using Shawe-Taylor's algorithm.  `"n"` must be at least 2.  Returns a list of two items: the prime and the certificate.

### random\_strong\_prime

Construct a random strong prime of `"n"` bits.  `"n"` must be at least 128.

### random\_proven\_prime

Generate or construct a random provable prime of `"n"` bits.  `"n"` must be at least 2.

### random\_proven\_prime\_with\_cert

Generate or construct a random provable prime of `"n"` bits.  `"n"` must be at least 2.  Returns a list of two items: the prime and the certificate.

## SEE ALSO

Math::Prime::Util

## AUTHORS

Dana Jacobsen \<dana@acm.org\>

## COPYRIGHT

Copyright 2012-2013 by Dana Jacobsen \<dana@acm.org\>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
