Boost logo

Boost Users :

From: Kent Holsinger (kent_at_[hidden])
Date: 2004-06-24 08:29:37


The following works fine for me on Windows 2000 with GCC. It's just your
code turned into a complete program. That suggests the problem is with
your test case, not your use of the RNG.

Note that this version will always produce the same output, since it
uses a default seed. If you want to produce different random sequences,
you'll need to seed the generator accordingly.


#include <iostream>
#include <boost/random.hpp>

int main(int ac, char** av) {
   printf(" Die \n ");
   try {
     boost::mt19937 rng;thin air
     boost::uniform_int<> six(1,6);
     boost::variate_generator<boost::mt19937, boost::uniform_int<> >
        die(rng, six);
     int x = die();
     printf(" Die %d\n ",x);
   catch(...) {
     std::cout << "exception" << std::endl;
     printf(" Die exception \n ");

Kent E. Holsinger                kent_at_[hidden]
-- Department of Ecology & Evolutionary Biology
-- University of Connecticut, U-3043
-- Storrs, CT   06269-3043

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at