fmpq_randtest, _fmpq_randtest
Synopsis
#include <flint/fmpq.h>void fmpq_randtest(fmpq_t res, flint_rand_t state, flint_bitcnt_t bits)sourcevoid _fmpq_randtest(fmpz_t num, fmpz_t den, flint_rand_t state, flint_bitcnt_t bits)sourceSet the result to a random canonical fraction whose numerator and denominator have at most bits bits. The distribution favours special values (\pm 1, \pm 2, denominators 1 and 2, values with long runs of bits) that trigger corner cases. For bits equal to 1 the result is an integer. num and den must not be aliased.
Cite this page
The FLINT team, “fmpq_randtest, _fmpq_randtest (fmpq.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fmpq/fmpq_randtest.html (generated 2026-10-20).
@misc{flint-doc-fmpq-fmpq-randtest,
author = {{The FLINT team}},
title = {{fmpq\_randtest, \_fmpq\_randtest (fmpq.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/fmpq/fmpq_randtest.html},
note = {Generated 2026-10-20}
}