Random integer generation

Sisyphus kalinabears@hdc.com.au
Sat, 15 Feb 2003 15:17:45 +1100


Hi,

I'm playing with mpz_urandomb(), GMP-4.1.2.

When I initialise 'state' with gmp_randinit_default() there's no problem.
But when I initialise 'state' with gmp_randinit_lc_2exp() I get the
following:

randraw.c:144: GNU MP assertion failed: m2exp / (32 - 0) < ta
abnormal program termination

Line 144 of randraw.c says:
ASSERT_ALWAYS (m2exp / GMP_NUMB_BITS < ta);

Is there perhaps some relationship between the various arguments that I'm
not adhering to ?

I guess there is, because I've just found that if I make m2exp small enough,
it produces output. But then the output is always the same, even though the
seed changes ??
(Having initialised the state, I'm seeding it with
gmp_randseed(), then running mpz_urandomb().)

Maybe I should just stick with the 'default'
initialisation :-)

Cheers,
Rob