FLINT3.7.0-dev

z_randint

Synopsis#include <flint/long_extras.h>
slong z_randint(flint_rand_t state, ulong limit)source

Returns a random value z with |z| < limit and a random sign (so 0 is returned twice as often as other values). If limit is zero or larger than WORD_MAX, it is replaced by WORD_MAX. The absolute value is n_randlimb(state) % limit, which is close to uniform.

Cite this page

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