Last active
July 28, 2020 14:30
-
-
Save ubaidh/962f3c9fa4dc7aedbd231f99b27b2e77 to your computer and use it in GitHub Desktop.
<random>
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<random> | |
int main(int argc, char**agrv) { //stateful generator with predefined min and max | |
std::default_random_engine eng; //std::default_random_engine random number engine class that generates pseudo-random numbers. | |
std::cout << "min :"<<eng.min() << "\n"; // min value | |
std::cout << "max :"<<eng.max() <<"\n"; //max value | |
std::cout << "random number :" << eng() << "\n"; //pseudorandom number | |
std::cin.get(); | |
return 0; | |
} | |
// g++ -std=c++11 -o random.exe 01-random.cpp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment