-----Original Message----- From: Jon Agiato [mailto:JonAgiato@n...]
I am having difficulty in understanding the documentation regarding the use of the pseudo-random number generators in boost::random. Below, I have created a small sample program of the type I am
--- In Boost-Users@yahoogroups.com, scleary@j... wrote: trying
to create in order to use the various classes in boost::random with Diehard (requires a binary file of 32 bit integers for testing). This program does not compile as it says that mersenne_twister requires template arguments. I understand what that means of course, but am unsure as to what arguments should go in there. I am using MSVC++ 7.0 and would really apprechiate any assistance. Thanks!
The Boost.Random library defines fully-generic random number generator algorithms, e.g., boost::random::mersenne_twister, boost::random::linear_congruential, etc. These are only for advanced users.
Hello Steve, and thank you for your kind help. I am trying to use the boost library as part of a project in which I demonstrate the validity of various random number generation algorithms and methodologies. I wanted to use boost to demonstrate what can be achieved through top class C++ generic programming.
The Boost.Random library also provides specializations of those
generic
random number generator algorithms for use by normal users. e.g., boost::mt19937 and boost::mt11213b are both specializations of the Mersenne twister; and boost::minstd_rand is a specialization of the linear congruential algorithm.
So, unless you have really exceptional random number requirements, you should be using boost::mt19937 instead of boost::random::mersenne_twister:
I used mt19937 as you directed and my example did compile but when I
ran the binary file through Diehard it failed every single test
every time. I am sure this can not be due to the algorithm, but I
can not pinpoint what I could be doing in error. Here is the code I
used to create a binary file for diehard:
#include <iostream>
using std::cout;
using std::cin;
#include <cstdlib>
#include
using boost::random::mersenne_twister;
using boost::mt19937;
mersenne_twister MT;
mt19937 MT;
Then your example should compile. -Steve
I was intending on using boost::random to demonstrate various deterministic and non-deterministic RNGs and their validity as far as randomness using Diehard. I am thinking either I am doing something wrong, or maybe I do require the use of the advanced RNG classes boost offers. Does anyone have any ideas? Again, thanks for any and all assistance. Jon Agiato JonAgiato@nyc.rr.com