+ 2

How can and do I use a randnom int if possible?

6th Oct 2016, 9:16 PM
TheGraveHunter
TheGraveHunter - avatar
3 Réponses
+ 1
thanks
6th Oct 2016, 11:51 PM
TheGraveHunter
TheGraveHunter - avatar
+ 1
#include <iostream> #include <ctime> int main() { srand(time(0)); std::cout<<(rand()%10+1)<<std::endl; return 0; } the above will output a random number 1-10 each time it is run with the seed being the current time
7th Oct 2016, 7:22 PM
Null Void
Null Void - avatar
0
Int x=rand();
6th Oct 2016, 10:00 PM
Xaviera Yayaell
Xaviera Yayaell - avatar