Created
July 30, 2012 13:29
-
-
Save YukiSakamoto/3206906 to your computer and use it in GitHub Desktop.
Mersenne Twister Algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/random.hpp> | |
using namespace boost; | |
int main(void) | |
{ | |
boost::mt19937 gen(static_cast<double>(time(0))); | |
boost::uniform_real<> range(0, 1); | |
boost::variate_generator< boost::mt19937, boost::uniform_real<> > random(gen, range); | |
for(int i(0); i < 128; i++) { | |
std::cout << random() << std::endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment