Torbjorn Granlund tg at
Thu Mar 6 01:35:38 CET 2008

"Jim Anderson" <janderson at> writes:

  The bug appears when the first call to mpz_urandomb() is made. If the integer is
  exported to an array of unsigned short, an extra nibble is inserted ahead of the
  legitimate data. The extra nibble caused problems with latter array processing.

128 shorts are generated, the most significant being non-zero.  You
seem to suggest that the most significant short should somehow be
just 8 bits, not 16 bits, since its 8 most significant bits are

Or perhaps what you really are suggesting us that when a random
number function is asked to generate k bits, the returned number
should be > 2^{k-2}.  That's not how we want them to work.

No GMP bug.


More information about the gmp-bugs mailing list