same random sequence generation

Gergely CZUCZY phoemix at
Fri Mar 31 15:02:33 CEST 2006


i've trying to generate random number with gmp, with the
new urandomb_ui function, and i'm unable to successed.
i run GMP4.2 on a windows XP box atm, the problem is that,
every time i run the application, it generates the very same
random sequence, however, it had been seeded with a different

The seeding algo:
---- chop with axe here ----
unsigned long int seed;
seed = rand();
seed ^= l.LowPart;
gmp_randseed_ui(c_rngstate, seed);
---- chop with axe here ----

and i generate a random number with this function:
---- chop with axe here ----
boost::uint32_t rndgen::generate() {
  return gmp_urandomb_ui(c_rngstate, 31);
---- chop with axe here ----

Every time i run the app the sequence begins as:
0x39bca874, 0x58d2754b

my question would be, what am i doing wrong?
GMP acts as the RNG hadn't been seeded, but it's do
seeded, as you see.


Gergely Czuczy
mailto: gergely.czuczy at

Weenies test. Geniuses solve problems that arise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url :

More information about the gmp-discuss mailing list