jeudi 14 février 2019

How do can I create a random integer in C++? [duplicate]

This question already has an answer here:

My problem is that I need a random integer between 1 and 5. I am using rand(), but this command only always gives the same pattern, and so I always get the same number. Is there any way that I can I avoid this issue ?

int k = rand()%6;




Aucun commentaire:

Enregistrer un commentaire