gmp_libmpn_random2 Method |
Namespace: Math.Gmp.Native
public static void mpn_random2( mp_ptr r1p, mp_size_t r1n )
Public Shared Sub mpn_random2 ( r1p As mp_ptr, r1n As mp_size_t )
public: static void mpn_random2( mp_ptr^ r1p, mp_size_t r1n )
static member mpn_random2 : r1p : mp_ptr * r1n : mp_size_t -> unit
The most significant limb is always non-zero. mpn_random generates uniformly distributed limb data, mpn_random2 generates long strings of zeros and ones in the binary representation.
mpn_random2 is intended for testing the correctness of the mpn routines.
// Create multi-precision operand. mp_ptr r1p = new mp_ptr(new uint[2]); // Generate random number. gmp_lib.mpn_random2(r1p, gmp_lib.mp_bytes_per_limb == 4 ? 2 : 1); // Release unmanaged memory. gmp_lib.free(r1p);
' Create multi-precision operand. Dim r1p As New mp_ptr(New UInteger(1) { }) ' Generate random number. gmp_lib.mpn_random2(r1p, If(gmp_lib.mp_bytes_per_limb = 4, 2, 1)) ' Release unmanaged memory. gmp_lib.free(r1p)
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.