same random sequence generation

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


hello

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
seed.

The seeding algo:
---- chop with axe here ----
unsigned long int seed;
LARGE_INTEGER l;
gmp_randinit_mt(c_rngstate);
QueryPerformanceCounter(&l);
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.

Bye,

Gergely Czuczy
mailto: gergely.czuczy at harmless.hu
PGP: http://phoemix.harmless.hu/phoemix.pgp

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 : http://gmplib.org/list-archives/gmp-discuss/attachments/20060331/5449cf7a/attachment.bin


More information about the gmp-discuss mailing list