How to generate different random numbers?

Forum Joiner forumjoiner at gmail.com
Wed Feb 1 09:06:20 CET 2006


Hello,


I have this code:
  // We generate the state
  gmp_randinit_default ( state_1 );

   // We generate the random number
   mpz_urandomb (random_n, state, 10);


The generated numbers are always the same. I don't know how to set the seed.
I work with Visual C++ 6 / gmp 1.4.2.


Some code examples would be very appreciated.

I know how to generate numbers from 1 to 2^10, but how to get numbers only
in the 2^9 ... 2^10 interval?
I don't want to filter the numbers from 1 to 2^10, rather I want to generate
directly only numbers from 2^9 ... 2^10 interval.


Thank you,
Mike



More information about the gmp-discuss mailing list