Algorithms N and V have been added to MPFR and will appear in the next release (presumably 3.2.0). In order to use them, check out the MPFR source with
svn checkout svn://scm.gforge.inria.fr/svn/mpfr/trunk mpfr
and follow the instructions for configuring, building, and installing it.
The added functions are
These are considerably more efficient than unit_normal_distribution and unit_exponential_distribution with an MPFR floating-point type particular when the precision is large. Because these routines write directly into the memory for a mpfr_t, the CPU time is proportional to the precision. In contrast, u_rand, in order to allow the use of a wide range of floating point types, generates high precision floating point numbers using a sequence of arithmetic operations whose cost scales as the square of the precision.
The program mpfr_times.cpp compares the time for mpfr_nrandom with mpfr_grandom, an implementation of polar method for normal sampling which appeared in MPFR 3.1. This (with tx multiplied by 10) is used to generate the timing data in Table 2, columns C and D, of the paper. Also compared is the time for unit_normal_distribution<mpfr::mpreal>.