GMP random number generation.

Mikhail Gorbachev gorbachevma at
Thu Mar 20 18:48:55 CET 2008

I'm using GMP libriary to generate random numbers. I wrote this code
    mpz_t rand_Num;
    gmp_randstate_t r_state;
    gmp_randinit_default (r_state);
    /* ...using generated random number...*/

However, I cannot get the random number. For each run of the program the 
result of this code is always rand_Num = 10356. When I change 14 to some 
other number, the value of rand_Num changes but always remains the same 
for the same number.

I'm using the latest version of GMP libriary (4.2.2)

Is there a bug here or I just do something wrong?

Please feel free to respond me any time.
Thank you very much.
Mikhail Gorbachev.

More information about the gmp-bugs mailing list