Class Random::Mpz

Nested Relationships

This class is a nested type of Class Random.

Class Documentation

class Mpz

Public Static Functions

static void uniform(mpz_class max_z, mpz_class &rand_val)

Generates and returns a random multiprecision integer. This may be used by other classes to consolidate the random MP generation.

Parameters
  • max_z: Maximum integer value. All generated random values will be in the range [0, max_z).
  • rand_val: Output value where the generated random number will be stored.

static SampleSize binom(SampleSize n, const mpz_class &t, const mpz_class &a)

Selects a binomially distributed random variable from Binom(n, a/t).

It may an approximate or exact version of the distribution depending on the state of the variable Random::Mpz::use_approx_binom_.

Return
Integer random variable generated according to the binomial distribution.
Parameters
  • n: Number of Bernoulli trials in the binomial distribution
  • t: Total weight of all samples
  • a: Weight of success.