Last active
September 16, 2015 17:16
-
-
Save JAChapmanII/aefbebc0f6308899ce9e to your computer and use it in GitHub Desktop.
c++ rand
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> | |
using std::random_device; | |
using std::uniform_int_distribution; | |
using std::generate_canonical; | |
int main(int, char **) { | |
// makes random numbers | |
random_device engine{}; | |
// generate in [0, 2] | |
uniform_int_distribution<int> uid{0, 2}; | |
auto result = uid(engine); | |
// generate in [0, 1), 10 bits | |
auto zeroToOne = generate_canonical<double, 10>(engine); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment