jeudi 9 avril 2015

mt_rand() doesn't return random number

I have the following piece of code:



unsigned int randomInt()
{
mt19937 mt_rand(time(0));
return mt_rand();
};


If I call this code, for example 4000 times in a for loop, I don't get random unsigned integers, insted I get for example 1000 times one value and the next 1000 times I get the next value.


What am I doing wrong?





Aucun commentaire:

Enregistrer un commentaire