reproducibility of GMP random functions vs limb size and GMP version

Paul Zimmermann Paul.Zimmermann at
Wed Sep 15 16:45:11 CEST 2010

       Hi GMP developers,

Sage uses GMP random functions in a way that enables the user to access the
GMP random seed:

sage: set_random_seed(17)
sage: ZZ.random_element()
sage: set_random_seed(42)
sage: ZZ.random_element()
sage: set_random_seed(17)
sage: ZZ.random_element()

The MPFR random functions use the GMP random seed. However to ensure the user
he/she will get the same results (for a given seed) whatever the limb size
and/or the GMP version, we assume that the GMP random functions do not depend
on the limb size nor the GMP version. This seems to hold, but it is not

Thus my question: please could you document this fact? (In particular that
after a call to any GMP random function, the random state is left in the same
state, i.e., the number of random bits read does not depend on the limb size.)

Best regards,
Paul Zimmermann

More information about the gmp-devel mailing list