FLINT3.7.0-dev

fmpz_randprime

Synopsis#include <flint/fmpz.h>
void fmpz_randprime(fmpz_t f, flint_rand_t state, flint_bitcnt_t bits, int proved)source

Sets f to a random prime with exactly bits \ge 2 bits: the next prime after a random integer of that size, retried until it has the right size, so the distribution is not exactly uniform over primes. If proved is nonzero the result is proved prime, otherwise it is a probable prime as in fmpz_nextprime.

Cite this page

The FLINT team, “fmpz_randprime (fmpz.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fmpz/fmpz_randprime.html (generated 2026-10-20).