
Thanks Steven! I found the issue - I was using boost 1.38 (which I incorrectly stated in my prev email that it was 1.39). I changed it to 1.39 and all's fine. Thanks again. -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Steven Watanabe Sent: Friday, July 24, 2009 4:40 PM To: boost@lists.boost.org Subject: Re: [boost] Random numbers question AMDG Anant Rao wrote:
I'm using Mersenne Twister algo to generate random numbers on Windows and Linux using the same code. Boost ver 1.39.
Here's the simple code I have:
boost::mt19937 rng(43); boost::uniform_01<boost::mt19937> zeroone(rng);
float randomNumber = zeroone();
If I run it multiple times, I get the same result on the same OS, as expected. However, the random numebrs are different between Windows and Linux.
Is this the expected behavior? Is there anything I can do to get the same random numbers on Windowd and Linux?
Can you post complete code along with the output. I get the same results from msvc and gcc from this program. #include <boost/random/uniform_01.hpp> #include <boost/random/mersenne_twister.hpp> int main() { boost::mt19937 rng(43); boost::uniform_01<boost::mt19937> zeroone(rng); for(int i = 0; i < 10; ++i) { float randomNumber = zeroone(); std::cout << randomNumber << std::endl; } } 0.115055 0.496861 0.609067 0.102915 0.133391 0.148773 0.24059 0.172133 0.327139 0.811036 In Christ, Steven Watanabe _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost