Skip to content

Instantly share code, notes, and snippets.

@sh-cho
Last active September 5, 2017 16:52
Show Gist options
  • Save sh-cho/4f74f6559f65e07cea2f3ca8f35ca5d9 to your computer and use it in GitHub Desktop.
Save sh-cho/4f74f6559f65e07cea2f3ca8f35ca5d9 to your computer and use it in GitHub Desktop.
c++11 random int
#include <random>
#include <iostream>
using namespace std;
int main() {
std::random_device rd;
std::mt19937 rng(rd());
std::uniform_int_distribution<int> uni(0, 10000000);
for (int i = 0; i < 10; ++i) {
cout << uni(rng) << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment