Problem with gmp_randinit_set
Pedro Gimeno
gmpdiscuss at formauri.es
Tue Feb 21 16:14:22 UTC 2017
Marco Bodrato wrote, On 2017-02-21 15:21:
> Problem: e is even!
> value and (2^n-k-value) will be mangled to the same seed...
> <snipped additional problem>
Well, these are more bugs then.
I've wanted to replace that seeding routine since it was written. I was never happy with it, but I didn't find a suitable replacement until 2006, and the idea of changing it was not very well received back then.
> Of course we can change the exponent, with a new one, co-prime with the
> Euler phi of 2^n-k... but this is an incompatible change.
As I said it's all or nothing. Either compatibility is kept, or the whole thing is changed to a better and faster seeding function. There's no point in trying to keep the spirit of the current algorithm, unless it can be shown to outperform the alternatives, which I seriously doubt.
>> Seeds bigger would generate different results, potentially breaking
>> compatibility if these are used, but I don't think there's a big chance of
>> that happening.
>
> If we change the function, the sequences will be changed for any value,
> right? It's not only an issue affecting "bigger seeds"...
Right. I meant that for example, if someone used 2^19937-20026 as seed, the sequence obtained should be the same as using 1 as seed. But I doubt anyone is using seeds that large. I said it with respect to the idea of taking seed mod 2^19936 instead of seed mod (2^19937 - 20027). The preceding sentence was:
>> I don't think it'd be a big deal to cut it out to 2^19936-1 now.
That would automatically break compatibility for seeds of 2^19936 and above. Is that important?
More information about the gmp-bugs
mailing list