Hi, I am new and am trying to use the Mersenne Twister Random number generator to generate a random number between 0 and 1 in one spot, and an integer between 0 and a variable to be allocated at the beginning of each run-through of a program. I tried to find the syntax and such, but examples given did not work on my computer. I am currently using Code::Blocks as my ide/compiler. Could someone explain to me how to use this generator? I know i need to use the seed member function to seed the generator and the operator() member function to get the random number, but past that I can't get these to work. Here is a sample of code I am trying. I get some odd warning about this not being supported and the chrono and mt19937 classes don't appear to work:
I'm suspecting you are getting compiler / linker errors - could you copy paste them here too please?
You may need to specify to your compiler to use the C++11 / C++0x standard, as these headers you're including only became available since that standard.
Unfortunately I'm not exactly sure how to do this in Code::blocks - presumably there's a setiing for compilerflags somewhere, where you could specify:
-std=c++0x
Presuming you're using Gcc/MingW, which I believe is the default compiler with Code::Blocks.
As C++11 features are being developed right now by the compiler developers, there are some features which are not, or just partly supported at the moment.