Created
September 15, 2015 20:15
-
-
Save tftio/8c94621ecbfdaf4c9e94 to your computer and use it in GitHub Desktop.
Random number in [0:1)
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> | |
#include <iostream> | |
// c++ -Wall -Werror -Wpedantic --std=c++11 -o ~/bin/random random.cpp | |
int main () { | |
std::random_device rd; | |
std::mt19937 mt(rd()); | |
std::uniform_real_distribution<double> dist(0, 1); | |
std::cout << dist(mt) << std::endl; | |
return(0); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment