mardi 24 février 2015

I have this sample code and it throws an error:



std::random_device rd; // only used once to initialise engine
std::mt19937 rng(rd); // random-number engine used
std::uniform_int_distribution<int> uni(0, 7); // guaranteed unbiased

int random_integer = uni(rng);


The error is:



Error 1 error C2039: 'generate' : is not a member of 'std::random_device' c:\program files (x86)\microsoft visual studio 12.0\vc\include\random 1618 1 Life



Can somone explain me please, why is this happening? It seems to be an error in the header file and not in my code.


How can I fix it?


Thank you.





Aucun commentaire:

Enregistrer un commentaire