/*
High precision randomizer using time since 1970 as unique seed
Standard: C++11
*/
#include <iostream>
#include <random> //mt19937 randomizer
#include <chrono> //high resolution clock
#include <functional> //bind
using namespace std;
int main() {
//accurate seed, seconds since 1970
auto seed= chrono::high_resolution_clock::now().time_since_epoch().count();
//high accuracy randomizer with integer range
auto roll= std::bind(std::uniform_int_distribution<int>(1,4), mt19937(seed));
int ctr= 100;
while(ctr) {
if(ctr%20 == 0) cout<<endl; //line break
cout << roll() << ' ';
--ctr;
}
}
Comments