This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/33128] New: std::tr1::uniform_int returns value out of range


The uniform_int distribution in the following program (copied from start of the
Boost random documentation) returns a value (-1) that is outside of its range.  

Thanks,

Mark Johnson

#include <iostream>
#include <tr1/random>

int main() {
  std::tr1::mt19937 rng;
  std::tr1::uniform_int<> six(1,6);
  std::tr1::variate_generator<std::tr1::mt19937, std::tr1::uniform_int<> >
            die(rng, six);
  std::cout << "die() = " << die() << std::endl;
}

// [mj@lugha tmp]$ a.out 
// die() = -1


-- 
           Summary: std::tr1::uniform_int returns value out of range
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mj1 at cog dot brown dot edu
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]