0

Which means 98 in the srand()?

int main () { srand(98); for (int x = 1; x <= 10; x++) { cout << 1 + (rand() % 6) << endl; } } What is the function of that parameter "98" and what is its range?

26th Jan 2017, 3:08 AM
johan buitrago
johan buitrago - avatar
1 Answer
+ 4
void srand(unsigned int seed) seed -- This is an integer value to be used as seed by the pseudo-random number generator algorithm. This function does not return any value. Seeding with current system time helps in generating different number everytime. It is invoked one time only prior to calling rand
26th Jan 2017, 3:31 AM
Megatron
Megatron - avatar