note: documentation bug

Stéphane Bosio sbosio at
Sun Feb 25 19:37:49 UTC 2018


I think there is an error in the following info section :

    * Random Number Functions::    Functions for generating random numbers.


    *note Integer Random Numbers::

the following can be read:

    -- Function: void mpz_rrandomb (mpz_t ROP, gmp_randstate_t STATE,
               mp_bitcnt_t N)
          Generate a random integer with long strings of zeros and ones in
          the binary representation.  Useful for testing functions and
          algorithms, since this kind of random numbers have proven to be
          more likely to trigger corner-case bugs.  The random number
    will be
          in the range 2^N-1 to 2^N-1, inclusive.

I'm pretty sure the intended range isn't 2^N-1 to 2^N-1, which is a 
single number, not a range and not random at all.

The range is probably -(2^N) to 2^N-1 as for usual signed integer types.

The only information relevant about GMP for this bug should be it's 
version which is 6.1.2.

I hope this helps. I apologize for my English, which is not my natural 


More information about the gmp-bugs mailing list