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)sourceint mpn_mod_randtest(nn_ptr res, flint_rand_t state, gr_ctx_t ctx)sourceSet 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).
@misc{flint-doc-mpn-mod-mpn-mod-rand,
author = {{The FLINT team}},
title = {{mpn\_mod\_rand, mpn\_mod\_randtest (mpn\_mod.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/mpn_mod/mpn_mod_rand.html},
note = {Generated 2026-10-20}
}