Go to the first, previous, next, last section, table of contents.
- Function: void mpz_random (mpz_t rop, mp_size_t max_size)
-
Generate a random integer of at most max_size limbs. The generated
random number doesn't satisfy any particular requirements of randomness.
Negative random numbers are generated when max_size is negative.
- Function: void mpz_random2 (mpz_t rop, mp_size_t max_size)
-
Generate a random integer of at most max_size limbs, with long strings
of zeros and ones in the binary representation. Useful for testing functions
and algorithms, since this kind of random numbers have proven to be more
likely to trigger corner-case bugs. Negative random numbers are generated
when max_size is negative.
- Function: size_t mpz_size (mpz_t op)
-
Return the size of op measured in number of limbs. If op is zero,
the returned value will be zero.
This function is obsolete. It will disappear from future MP
releases.
- Function: size_t mpz_sizeinbase (mpz_t op, int base)
-
Return the size of op measured in number of digits in base base.
The base may vary from 2 to 36. The returned value will be exact or 1 too
big. If base is a power of 2, the returned value will always be exact.
This function is useful in order to allocate the right amount of space before
converting op to a string. The right amount of allocation is normally
two more than the value returned by mpz_sizeinbase
(one extra for a
minus sign and one for the terminating '\0').
Go to the first, previous, next, last section, table of contents.