Created
December 3, 2015 14:32
-
-
Save jsxinvivo/f628f2726410d7143f84 to your computer and use it in GitHub Desktop.
Generating random number using C++ 11 <random> library
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 <random> | |
std::random_device rseed; | |
std::mt19937 rgen(rseed()); // mersenne_twister | |
std::uniform_int_distribution<int> idist(0,100); // [0,100] | |
std::cout << idist(rgen) << std::endl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment