FLINT3.7.0-dev

mpn_mod_rand, mpn_mod_randtest

Synopsis#include <flint/mpn_mod.h>
int mpn_mod_rand(nn_ptr res, flint_rand_t state, gr_ctx_t ctx)source
int mpn_mod_randtest(nn_ptr res, flint_rand_t state, gr_ctx_t ctx)source

Set res to a random element. mpn_mod_rand draws uniformly from [0, n) (fmpz_randm); mpn_mod_randtest uses fmpz_randtest_mod, which favours special values such as 0, 1 and n - 1 and values with long runs of zero or one bits, for testing.

Cite this page

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