FLINT3.7.0-dev

nmod_mat_randtril, nmod_mat_randtriu

Synopsis#include <flint/nmod_mat.h>
void nmod_mat_randtril(nmod_mat_t mat, flint_rand_t state, int unit)source
void nmod_mat_randtriu(nmod_mat_t mat, flint_rand_t state, int unit)source

Sets mat to a random lower, respectively upper, triangular matrix. The entries strictly below (above) the diagonal are random, the diagonal entries are 1 if unit is nonzero and random nonzero values otherwise. mat need not be square.

A diagonal entry that comes out as 0 is replaced by 1. For composite n the diagonal entries need not be invertible.

Cite this page

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