#165 Error in documentation of MersenneTwisterUniformRng

open
nobody
None
5
2014-08-25
2013-12-06
Mikail Sheikh
No

The documentation of the random number generators states that the values fall in the open interval (0.0, 1.0), i.e. without the end points.

If MersenneTwisterUniformRng compiled with 32 bit Real numbers
When QuantLib is compiled with 32 bit floating point precision QL_REAL=float the line

return (Real(nextInt32()) + 0.5)/4294967296.0;

can evalueate to

return (float(4294967295) + 0.5)/4294967296.0;

This evaluates to 1.0f exactly

Discussion