#include <iostream>
#include <functional>
#include <random>
using namespace std;
int main()
{
default_random_engine generator;
int dist1Max = 10, dist2Max = 10;
uniform_int_distribution<int> dist1(1, dist1Max);
uniform_int_distribution<int> dist2(1, dist2Max);
function<int()> boundDist1 = std::bind(dist1, std::ref(generator));
function<int()> boundDist2 = std::bind(dist2, std::ref(generator));
for (int i=0; i<10; ++i)
{
cout << boundDist1() << " " << boundDist2() << endl;
}
cout << endl;
for (int i=0; i<10; ++i)
{
cout << dist1(generator) << " " << dist2(generator) << endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnVuY3Rpb25hbD4KI2luY2x1ZGUgPHJhbmRvbT4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpCnsKICAgIGRlZmF1bHRfcmFuZG9tX2VuZ2luZSBnZW5lcmF0b3I7CgogICAgaW50IGRpc3QxTWF4ID0gMTAsIGRpc3QyTWF4ID0gMTA7CgogICAgdW5pZm9ybV9pbnRfZGlzdHJpYnV0aW9uPGludD4gZGlzdDEoMSwgZGlzdDFNYXgpOwogICAgdW5pZm9ybV9pbnRfZGlzdHJpYnV0aW9uPGludD4gZGlzdDIoMSwgZGlzdDJNYXgpOwoKICAgIGZ1bmN0aW9uPGludCgpPiBib3VuZERpc3QxID0gc3RkOjpiaW5kKGRpc3QxLCBzdGQ6OnJlZihnZW5lcmF0b3IpKTsKICAgIGZ1bmN0aW9uPGludCgpPiBib3VuZERpc3QyID0gc3RkOjpiaW5kKGRpc3QyLCBzdGQ6OnJlZihnZW5lcmF0b3IpKTsKCiAgICBmb3IgKGludCBpPTA7IGk8MTA7ICsraSkKICAgIHsKICAgICAgICBjb3V0IDw8IGJvdW5kRGlzdDEoKSA8PCAiICIgPDwgYm91bmREaXN0MigpIDw8IGVuZGw7CiAgICB9CiAgICBjb3V0IDw8IGVuZGw7CgogICAgZm9yIChpbnQgaT0wOyBpPDEwOyArK2kpCiAgICB7CiAgICAgICAgY291dCA8PCBkaXN0MShnZW5lcmF0b3IpIDw8ICIgIiA8PCBkaXN0MihnZW5lcmF0b3IpIDw8IGVuZGw7CiAgICB9Cn0=