[Bug libstdc++/40331] New: uniform_real random number distribution produces wildly out of range values (TR1 & C++0x)

colin at gibibit dot com gcc-bugzilla@gcc.gnu.org
Wed Jun 3 15:49:00 GMT 2009


Using either the std::tr1 or C++0x std:: random number generators, the
uniform_real distribution produces numbers that are completely wrong.

For instance, using Boost.Random the test program produces this sequence of
floating point numbers:

Random real: 0.0975404
Random real: 0.547221
Random real: 0.278498
...

On the other hand, both the TR1 and C++0x random number generators produce
something like

Random real: 4.18933e+08
Random real: 2.35029e+09
Random real: 1.19614e+09
...

instead.

This is using the mt19937 random number generator engine and the uniform_real
distribution.  I have tried both uniform_real<float> and uniform_real<double>
and they both have this bug.


-- 
           Summary: uniform_real random number distribution produces wildly
                    out of range values (TR1 & C++0x)
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: colin at gibibit dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40331



More information about the Gcc-bugs mailing list