gmp_libmpz_random Method |
Namespace: Math.Gmp.Native
Assembly: Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)

public static void mpz_random( mpz_t rop, mp_size_t max_size )
Public Shared Sub mpz_random ( rop As mpz_t, max_size As mp_size_t )
public: static void mpz_random( mpz_t^ rop, mp_size_t max_size )
static member mpz_random : rop : mpz_t * max_size : mp_size_t -> unit
Parameters
- rop
- Type: Math.Gmp.Nativempz_t
The result integer. - max_size
- Type: Math.Gmp.Nativemp_size_t
The maximum number of limbs.

The generated random number doesn’t satisfy any particular requirements of randomness. Negative random numbers are generated when max_size is negative.
This function is obsolete. Use mpz_urandomb or mpz_urandomm instead.
The random number functions of GMP come in two groups; older function that rely on a global state, and newer functions that accept a state parameter that is read and modified. Please see the GNU MP - Random Number Functions for more information on how to use and not to use random number functions.

// Create, initialize, and set the value of rop to 0. mpz_t rop = new mpz_t(); gmp_lib.mpz_init(rop); // Generate a random integer. gmp_lib.mpz_random(rop, 500); // Free all memory occupied by state and rop. gmp_lib.mpz_clear(rop);
' Create, initialize, and set the value of rop to 0. Dim rop As New mpz_t() gmp_lib.mpz_init(rop) ' Generate a random integer. gmp_lib.mpz_random(rop, 500) ' Free all memory occupied by state and rop. gmp_lib.mpz_clear(rop)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
