Created
January 7, 2019 15:25
-
-
Save ubaidh/30888e2c99acbab45785d7efc941dfcd to your computer and use it in GitHub Desktop.
<random> function to print random numbers
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> | |
void printrandom(std::default_random_engine e) { | |
for (int i = 0; i < 10; i++) { | |
std::cout << e() << " "; | |
} | |
std::cout << "\n"; | |
} | |
int main(int argc, char**agrv) { | |
std::default_random_engine eng; | |
std::default_random_engine eng2; | |
printrandom(eng); | |
printrandom(eng2); //both produce same numbers | |
std::cin.get(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment