Problem with gmp_randinit_set

Marco Bodrato bodrato at mail.dm.unipi.it
Mon Feb 20 22:52:45 UTC 2017


Ciao,

Il Lun, 20 Febbraio 2017 9:25 pm, Torbjörn Granlund ha scritto:
> "Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:
>
>   They all will represent the numbers (n) in the range 0..20022 with their
>   equivalent (2^19937-20023+n). The sketched proof follows.
>
> Is that true also for n < 20022...?

Yes, because, in the powering process, the number grows larger than 20022,
and the reduce process will never give a small number again.

I mean: the reduction function we wrote (and the current mpz
implementation), would leave a number n<20022 untouched.
But the square-reduce-multiply-reduce process used to compute
seed^1074888996 will for sure end up with a result >= 20023.

This is false if the starting seed is 0 or 1, but this case is avoided by
the initial
  seed1 = seed mod (2^19937-20027) + 2

Regards,
m

-- 
http://bodrato.it/toom/



More information about the gmp-devel mailing list