an example of using C++
uniform_int_distribution, which is also a function object class
👍 g++ -std=c++11 eng_n_dist.cpp && ./a.out
2 6 5 1 3 1
1 3 3 3 5 1
👍 cat eng_n_dist.cpp
#include <iostream>
#include <vector>
#include <random>
using namespace std;
vector<unsigned> randV() {
static default_random_engine e;
static
uniform_int_distribution<unsigned>
u(1, 6);
vector ret;
for (size_t i = 0; i < 6; ++i)
ret.push_back(u(e));
return ret;
}
int main() {
vector v;
v = randV();
for(auto n : v) cout << n << ' ';
cout << endl;
v = randV();
for(auto n : v) cout << n << ' ';
cout << endl;
}