dimanche 25 décembre 2016

pre-c++11 replacement for std::random_device and std::mt19937

i'm trying to remove #include <random> because it won't run at below C++ 11 what is the good replacement for this

short nB[3];
std::random_device rseed;
std::mt19937 rng(rseed());
std::uniform_int_distribution<short> dist(pStruct->nMainBM, pStruct->nMainBM);
std::uniform_int_distribution<short> dist1(pStruct->nStatBM, pStruct->nStatBM);
std::uniform_int_distribution<short> dist2(pStruct->nDM, pStruct->nDM);
nB[0] = dist(rng);
nB[1] = dist1(rng);
nB[2] = dist2(rng);

Aucun commentaire:

Enregistrer un commentaire