gmp_libmpz_random2 Method |
Generate a random integer of at most max_size limbs, with long strings of zeros and ones in the binary representation.
Namespace:
Math.Gmp.Native
Assembly:
Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static void mpz_random2(
mpz_t rop,
mp_size_t max_size
)
Public Shared Sub mpz_random2 (
rop As mpz_t,
max_size As mp_size_t
)
public:
static void mpz_random2(
mpz_t^ rop,
mp_size_t max_size
)
static member mpz_random2 :
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.
Remarks
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.
This function is obsolete. Use mpz_rrandomb 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.
Examples
mpz_t rop = new mpz_t();
gmp_lib.mpz_init(rop);
gmp_lib.mpz_random(rop, 100);
gmp_lib.mpz_clear(rop);
Dim rop As New mpz_t()
gmp_lib.mpz_init(rop)
gmp_lib.mpz_random(rop, 100)
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.
See Also