AMDG Phillip Jones wrote:
I wanted to save the initial state of a random number generator and I ran into this issue -
boost::mt19937 rng; unsigned int rseed = static_cast<unsigned int>(std::time(0)); //rng.seed( rseed ); // This causes an error rng.seed( static_cast<unsigned int>(rseed) ); // ok
The error is "mersenne_twister.hpp:103: error: `gen' cannot be used as a function".
Obviously not a big problem since I can just use the cast and keep going. But is there a reason for this behavior? It seems odd that one must cast an unsigned int as an unsigned int to make it work
This is definitely a bug. Please file a trac ticket at svn.boost.org.
The following works.
#include <ctime>
#include