FLINT3.7.0-dev

fmpz_mod_ctx_init_rand_bits, fmpz_mod_ctx_init_rand_bits_prime

Synopsis#include <flint/fmpz_mod.h>
void fmpz_mod_ctx_init_rand_bits(fmpz_mod_ctx_t ctx, flint_rand_t state, flint_bitcnt_t max_bits)source
void fmpz_mod_ctx_init_rand_bits_prime(fmpz_mod_ctx_t ctx, flint_rand_t state, flint_bitcnt_t max_bits)source

Initialise ctx with a random modulus, for testing: 2 + m with m a random integer of at most max_bits bits (from fmpz_randtest_unsigned), respectively the least probable prime (fmpz_nextprime without proof) greater than such an m. The modulus can have slightly more than max_bits bits.

Cite this page

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