FLINT3.7.0-dev

fmpq_randbits, _fmpq_randbits

Synopsis#include <flint/fmpq.h>
void fmpq_randbits(fmpq_t res, flint_rand_t state, flint_bitcnt_t bits)source
void _fmpq_randbits(fmpz_t num, fmpz_t den, flint_rand_t state, flint_bitcnt_t bits)source

Choose a numerator and a nonzero denominator of exactly bits bits each and canonicalise, so the components of the result can have fewer bits. num and den must not be aliased.

Cite this page

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