Boost C++ Libraries: Ticket #11: why not using mt19937? https://svn.boost.org/trac10/ticket/11 <pre class="wiki">i complie the random_demo.cpp, everything is ok. ( VC6 + SP5 ) following is code: /* boost random_demo.cpp profane demo * * Copyright Jens Maurer 2000 * Permission to use, copy, modify, sell, and distribute this software * is hereby granted without fee provided that the above copyright notice * appears in all copies and that both that copyright notice and this * permission notice appear in supporting documentation, * * Jens Maurer makes no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * $Id: random_demo.cpp,v 1.5 2001/05/31 17:19:14 jmaurer Exp $ * * A short demo program how to use the random number library. */ #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;ctime&gt; // std::time #include &lt;boost/random/linear_congruential.hpp&gt; #include &lt;boost/random/uniform_smallint.hpp&gt; #include &lt;boost/random/uniform_01.hpp&gt; // try boost::mt19937 or boost::ecuyer1988 instead of boost::minstd_rand typedef boost::minstd_rand base_generator_type; // This is a reproducible simulation experiment. void experiment(base_generator_type &amp; generator) { boost::uniform_smallint&lt;base_generator_type&gt; die (generator, 1, 6); // you can use a STL Iterator interface for(int i = 0; i &lt; 10; i++) std::cout &lt;&lt; *die++ &lt;&lt; " "; std::cout &lt;&lt; '\n'; } int main() { // initialize by reproducible seed base_generator_type generator(42); std::cout &lt;&lt; "10 samples of a uniform distribution in [0..1):\n"; boost::uniform_01&lt;base_generator_type&gt; uni (generator); std::cout.setf(std::ios::fixed); // you can also use a STL Generator interface for(int i = 0; i &lt; 10; i++) std::cout &lt;&lt; uni() &lt;&lt; '\n'; // change seed to something else // Note: this is not the preferred way of hacking around missing std:: generator.seed( #ifndef BOOST_NO_STDC_NAMESPACE std:: #endif time(0)); std::cout &lt;&lt; "\nexperiment: roll a die 10 times:\n"; base_generator_type saved_generator = generator; experiment(generator); std::cout &lt;&lt; "redo the experiment to verify it:\n"; experiment(saved_generator); // after that, both generators are equivalent assert(generator == saved_generator); #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE { // save the generator state for future use, // can be read again at any time via operator&gt;&gt; std::ofstream file("rng.saved", std::ofstream::trunc); file &lt;&lt; generator; } #endif // Some compilers don't pay attention to std:3.6.1/5 and issue a // warning here if "return 0;" is omitted. return 0; } however, i use typedef boost::boost::mt19937 base_generator_type; this sentence instead of old typedef boost::minstd_rand base_generator_type; sentence, complier report error: " d:\project\boost_1_25_0 \boost\random\mersenne_twister.hpp(86) : error C2064: term does not evaluate to a function d:\project\boost_1_25_0 \boost\random\mersenne_twister.hpp(66) : see reference to function template instantiation 'void __thiscall boost::random::mersenne_twister&lt;unsigned long,624,397,31,-1727483681,11,7,-1658038656,15,- 272236544,18,-9485417 30&gt;::seed(const int &amp;)' being compiled " i don't know why???who can tell me? </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11 Trac 1.4.3 jmaurer Thu, 08 Nov 2001 22:00:57 GMT status changed https://svn.boost.org/trac10/ticket/11#comment:1 https://svn.boost.org/trac10/ticket/11#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=53943 I've checked in changes to random_demo.cpp which should allow flawless interaction with mt19937. Please check out the CVS. </pre> Ticket