+ 1

Whats the reason for usind rand()%15??

26th Mar 2018, 9:32 AM
Shuvam Lal
Shuvam Lal - avatar
2 ответов
+ 5
it generates random number between 0 and 14... if you need random number you will use rand
26th Mar 2018, 9:44 AM
Elva
Elva - avatar
0
(rand()%15) just means it will generate a random number larger then 0 and less then 15. In C++ you can assign the rand() function to variables and call them later in your code... eg. int var; var=(rand()%14); cout<<var;
26th Mar 2018, 12:59 PM
Jordan Patterson
Jordan Patterson - avatar