id summary reporter owner description type status milestone component version severity resolution keywords cc 11 why not using mt19937? nobody jmaurer "{{{ 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 #include #include // std::time #include #include #include // 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 & generator) { boost::uniform_smallint die (generator, 1, 6); // you can use a STL Iterator interface for(int i = 0; i < 10; i++) std::cout << *die++ << "" ""; std::cout << '\n'; } int main() { // initialize by reproducible seed base_generator_type generator(42); std::cout << ""10 samples of a uniform distribution in [0..1):\n""; boost::uniform_01 uni (generator); std::cout.setf(std::ios::fixed); // you can also use a STL Generator interface for(int i = 0; i < 10; i++) std::cout << uni() << '\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 << ""\nexperiment: roll a die 10 times:\n""; base_generator_type saved_generator = generator; experiment(generator); std::cout << ""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>> std::ofstream file(""rng.saved"", std::ofstream::trunc); file << 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::seed(const int &)' being compiled "" i don't know why???who can tell me? }}}" Bugs closed random None Fixed