Last active
March 12, 2018 11:49
-
-
Save PaulChana/bbb8d564fc5f55509e01cf1957449cd9 to your computer and use it in GitHub Desktop.
C++ uniform distribution random numbers
This file contains hidden or 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 rd; | |
std::mt19937 gen(rd()); | |
std::uniform_int_distribution<> dis(1, 6); | |
const int rnd = dis(gen); | |
std::random_device rd; | |
std::mt19937 gen(rd()); | |
std::uniform_real_distribution<> dis(-1.f, 1.f); | |
const float rnd = dis(gen); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment