Next: Random State Seeding, Previous: Random Number Functions, Up: Random Number Functions [Index]
Initialize state with a default algorithm. This will be a compromise
between speed and randomness, and is recommended for applications with no
special requirements. Currently this is gmp_randinit_mt
.
Initialize state for a Mersenne Twister algorithm. This algorithm is fast and has good randomness properties.
Initialize state with a linear congruential algorithm X = (a*X + c) mod 2^m2exp.
The low bits of X in this algorithm are not very random. The least significant bit will have a period no more than 2, and the second bit no more than 4, etc. For this reason only the high half of each X is actually used.
When a random number of more than m2exp/2 bits is to be generated, multiple iterations of the recurrence are used and the results concatenated.
Initialize state for a linear congruential algorithm as per
gmp_randinit_lc_2exp
. a, c and m2exp are selected
from a table, chosen so that size bits (or more) of each X will
be used, ie. m2exp/2 >= size.
If successful the return value is non-zero. If size is bigger than the table data provides then the return value is zero. The maximum size currently supported is 128.
Initialize rop with a copy of the algorithm and state from op.
Free all memory occupied by state.
Next: Random State Seeding, Previous: Random Number Functions, Up: Random Number Functions [Index]