Building boost to NOT USE built-in Visual Studio 2010 TR1 random

Dear Boost-Users boost 1.49.0 and Visual Studio 2010 / Visual Studio 2005 / & g++ 4.6.3 on (Win7 and Ubuntu 12.04) Build boost libs locally, using the local compilers. The objective is to get exactly the same random number generator behaviour for the same application built with VS2005, VS2010 and Gnu compilers. Building the same code, I see the* same normal & uniform* results under gnu and VS2005 builds (presumably boost random is used under VS2005). Building the same code, I see the different *normal results* under gnu and VS2010 builds (presumably the native VC lib is used under VS2010). So I would like to use (at least) boost's random library instead of the native Visual C++ 2010 library.
From boost docs I learned that it is possible to set up the boost config files such as to use/not use the native compiler/library TR1 implementation: http://www.boost.org/doc/libs/1_49_0/libs/config/doc/html/index.html#boost_c... http://www.boost.org/doc/libs/1_49_0/libs/config/doc/html/boost_config/boost... http://www.boost.org/doc/libs/1_49_0/doc/html/boost_tr1/usage.html#boost_tr1...
I cannot however, figure out how to do this from the above docs. BOOST_HAS_TR1_RANDOM comes into it, but I fail to get the big picture. Can anybody please advise? thanks in advance! nelis

boost 1.49.0 and Visual Studio 2010 / Visual Studio 2005 / & g++ 4.6.3 on (Win7 and Ubuntu 12.04) Build boost libs locally, using the local compilers.
The objective is to get exactly the same random number generator behaviour for the same application built with VS2005, VS2010 and Gnu compilers.
Building the same code, I see the* same normal & uniform* results under gnu and VS2005 builds (presumably boost random is used under VS2005).
Building the same code, I see the different *normal results* under gnu and VS2010 builds (presumably the native VC lib is used under VS2010).
So I would like to use (at least) boost's random library instead of the native Visual C++ 2010 library.
From boost docs I learned that it is possible to set up the boost config files such as to use/not use the native compiler/library TR1 implementation: http://www.boost.org/doc/libs/1_49_0/libs/config/doc/html/index.html#boost_c... http://www.boost.org/doc/libs/1_49_0/libs/config/doc/html/boost_config/boost... http://www.boost.org/doc/libs/1_49_0/doc/html/boost_tr1/usage.html#boost_tr1...
I cannot however, figure out how to do this from the above docs. BOOST_HAS_TR1_RANDOM comes into it, but I fail to get the big picture.
Can anybody please advise?
You can't force the Boost.TR1 library *not* to use the native version if it's available since those names have already been taken up in std::tr1. Just use Boost.Random directly instead. HTH, John.

John Maddock
The objective is to get exactly the same random number generator behaviour for the same application built with VS2005, VS2010 and Gnu compilers.
You can't force the Boost.TR1 library *not* to use the native version if it's available since those names have already been taken up in std::tr1. Just use Boost.Random directly instead.
HTH, John.
Thanks John, it did help! After reading your reply and looking at the boost header files (read the flaming source!) I realised that one must use the boost::random namespace qualifier instead of std::tr1. It works beautifully now! thanks! nelis
participants (3)
-
John Maddock
-
nelis
-
Nelis Willers