+ 2

Anyone know to randomize values in c++

24th Dec 2017, 6:42 AM
Vishal Kumar
4 Respuestas
+ 6
Use: <include ctime> srand(time(0)): int random = rand();
24th Dec 2017, 6:54 AM
David Akhihiero
David Akhihiero - avatar
+ 9
For example if you want a random number between 1 and 6(maybe for a dice game): #include <ctime> srand(time(0)); int diceNumber = 1 + rand() % 6;
24th Dec 2017, 6:59 AM
David Akhihiero
David Akhihiero - avatar
+ 1
how to give the output of two variables .can u give an example using two variable
24th Dec 2017, 6:55 AM
Vishal Kumar
+ 1
thanks
24th Dec 2017, 7:01 AM
Vishal Kumar