Click or drag to resize
gmp_libgmp_randinit_lc_2exp_size Method
Initialize state for a linear congruential algorithm as per gmp_randinit_lc_2exp.

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 int gmp_randinit_lc_2exp_size(
	gmp_randstate_t state,
	mp_bitcnt_t size
)

Parameters

state
Type: Math.Gmp.Nativegmp_randstate_t
The state to initialize.
size
Type: Math.Gmp.Nativemp_bitcnt_t

Return Value

Type: Int32
If successful the return value is non-zero. If size is bigger than the table data provides then the return value is zero.
Remarks

a, c and m2exp are selected from a table, chosen so that size bits (or more) of each X will be used, i.e. m2exp / 2 ≥ size.

Examples
// Create new random number generator state.
gmp_randstate_t state = new gmp_randstate_t();

// Initialize state with a linear congruential random number generator algorithm.
gmp_lib.gmp_randinit_lc_2exp_size(state, 30);

// Free all memory occupied by state.
gmp_lib.gmp_randclear(state);
See Also