Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <random>
- #include <chrono>
- using namespace std;
- int main() {
- srand((unsigned) time(NULL));
- int a = (int) (rand() / ((double) RAND_MAX + 1.) * 3.);
- unsigned seed = chrono::system_clock::now().time_since_epoch().count();
- mt19937_64 generator(seed);
- uniform_int_distribution<int> distribution(0, 2);
- int b = distribution(generator);
- cout << "cstdlib: " << a << endl;
- cout << "random (c++11): " << b << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement