samedi 28 novembre 2015

Generate random number without srand

I need to generate a random number with srand. I used :

std::default_random_engine generator;
std::uniform_int_distribution<int> distribution(1,6);
int dice_roll = distribution(generator);  // generates number in the range 1..6 

but it keeps generating same number.




Aucun commentaire:

Enregistrer un commentaire