Boost logo

Boost Users :

From: Joshua Little (ljoshua_at_[hidden])
Date: 2004-06-25 22:31:36

Kent Holsinger wrote:

> Joshua,
> 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.
> Kent
> #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 ");
> }
> }
You were correct. I put that code into its own program and it ran just
fine.. so I'm not sure what the deal is in my test cases, I don't know
why it would kill the output since its basically the exact same code.
This is the strangest thing I've seen in a while and I really have no
idea what might be the problem.


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