mpz_probab_prime_p reproducibility

Pierre Chatelier pierre at chachatelier.fr
Wed Nov 16 21:29:55 UTC 2016


Hello,

>>  I think that indeed, the *results* are the same (the contrary would be
>>  a real problem), but not the execution.
>> 
> I'd love to grasp the logic behind that reasoning. :-)
It makes perfect sense for me but under the light of what follows, I just fooled myself.

>>  The set of miller rabin tests seems not to be the same for two
>>  consecutive calls, since there is the
>>  mpz_urandomm (x, rstate, nm3) part (and that no deterministic seed
>>  seems to be used for the randstate)
> 
> I suggest that you add some printing to the code before you insist on
> your interpretation.  (I suppose we could clarify the manual about
> initial state of gmp_randstate_t.)

Aaaaaannnd obviously you are right.
I checked that gmp_randinit_default() performs a non-documented, but definitely not undefined state initialization.
I really believed that a seed was needed after that.

I don't know yet if gmp_randinit_default() is architecture- or platform-dependent, but I will investigate.

Pierre






More information about the gmp-discuss mailing list