FLINT3.7.0-dev

gr_ctx_init_random, gr_ctx_init_random_commutative_ring, gr_ctx_init_random_field, gr_ctx_init_random_finite_field

Synopsis#include <flint/gr.h>
void gr_ctx_init_random(gr_ctx_t ctx, flint_rand_t state)source
void gr_ctx_init_random_commutative_ring(gr_ctx_t ctx, flint_rand_t state)source
void gr_ctx_init_random_field(gr_ctx_t ctx, flint_rand_t state)source
void gr_ctx_init_random_finite_field(gr_ctx_t ctx, flint_rand_t state)source

Initialise ctx to a random ring, commutative ring, field or finite field. The rings are drawn from the built-in base rings (\mathbb{Z}, \mathbb{Q}, \mathbb{Z}[i], \mathbb{Z}/n\mathbb{Z} in its various representations, finite fields, number fields, balls, Calcium fields) and from rings built over some of them (polynomials, multivariate polynomials, series, vectors, matrices and debug wrappers). The base rings of the composite rings are kept in static storage, so only ctx is cleared by the caller.

Currently gr_ctx_init_random returns, with probability 1/2, the ring of power series of precision 1 over the zero ring \mathbb{Z}/1\mathbb{Z}, and only otherwise draws from the list above.

Cite this page

The FLINT team, “gr_ctx_init_random, gr_ctx_init_random_commutative_ring, gr_ctx_init_random_field, gr_ctx_init_random_finite_field (gr.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_domains/gr_ctx_init_random.html (generated 2026-10-20).