Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <random>
- #include <iostream>
- using namespace std;
- int main()
- {
- random_device rd; // non-deterministic generator
- mt19937 gen(rd()); // to seed mersenne twister.
- uniform_int_distribution<> dist(1,6); // distribute results between 1 and 6 inclusive.
- for (int i = 0; i < 5; ++i) {
- cout << dist(gen) << " "; // pass the generator to the distribution.
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement