pub fn random_integer_polynomials(
seed: Seed,
mean_bits_numerator: u64,
mean_bits_denominator: u64,
mean_length_numerator: u64,
mean_length_denominator: u64,
) -> RandomIntegerPolynomialsFromIntegersExpand description
Generates random IntegerPolynomials.
The coefficients are sampled from random_integers and the leading coefficient from
random_nonzero_integers, both with a mean bit count of mean_bits_numerator / mean_bits_denominator.
The lengths — the number of coefficients, which is one more than the degree, or zero for the
zero polynomial — are sampled from a geometric distribution with mean mean_length_numerator / mean_length_denominator, so the zero polynomial is generated with the probability that that
distribution gives to 0.
§Worst-case complexity per iteration
$T(i) = O(\ell b)$
$M(i) = O(\ell b)$
where $T$ is time, $M$ is additional memory, $i$ is the iteration number, $\ell$ is the number
of coefficients of the $i$th output, and $b$ is mean_bits_numerator / mean_bits_denominator.
§Panics
Panics if mean_bits_numerator or mean_bits_denominator are zero, if their ratio is less than
or equal to 1, or if mean_length_numerator or mean_length_denominator are zero or their
ratio is greater than or equal to $2^{64}$.
§Examples
use malachite_base::iterators::prefix_to_string;
use malachite_base::random::EXAMPLE_SEED;
use malachite_nz::integer_polynomial::random::random_integer_polynomials;
assert_eq!(
prefix_to_string(random_integer_polynomials(EXAMPLE_SEED, 4, 1, 1, 1), 5),
"[14, -2*x-497, 2*x-1, 122*x+1, 1, ...]"
);