reproducibility of GMP random functions vs limb size and GMP version

Vincent Lefevre vincent+gmp at vinc17.org
Fri Sep 17 10:00:19 CEST 2010


On 2010-09-16 20:17:34 +0200, Pedro Gimeno wrote:
> Paul Zimmermann wrote:
> 
> > as far as such a change is documented in the new version, it is fine
> > for us. We were more concerned for a difference between the same GMP
> > version on different hardware, but Torbjörn's answer clarifies this.
> 
> The current code should give the same values in all platforms. If that's
> not the case then that's a bug that should be fixed as quickly as
> possible. A pseudorandom function is not that different from the rest of
> functions of GMP; the only difference is that it returns a sequence
> instead of a value, for a given input value (seed).

There's a difference: the other functions are well-specified, while
the pseudorandom function isn't necessarily specified. The GMP manual
says:

 -- Function: void gmp_randinit_default (gmp_randstate_t STATE)
     Initialize STATE with a default algorithm.  This will be a
     compromise between speed and randomness, and is recommended for
     applications with no special requirements.  Currently this is
     `gmp_randinit_mt'.

First, it is not clear whether other versions will use something else
than gmp_randinit_mt (I suppose this would be an interface change).
More importantly, for gmp_randinit_mt:

 -- Function: void gmp_randinit_mt (gmp_randstate_t STATE)
     Initialize STATE for a Mersenne Twister algorithm.  This algorithm
     is fast and has good randomness properties.

The fact that it says "*a* Mersenne Twister algorithm" means that there
are several such algorithms (possibly dependening on some unspecified
constants), and it is not clear that exactly the same algorithm is used
everywhere.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


More information about the gmp-devel mailing list