|
Boost Users : |
Subject: [Boost-users] Must cast unsigned int for random generator seed
From: Phillip Jones (pjones13_at_[hidden])
Date: 2008-10-18 15:14:35
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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net