Which of the following statements generates a random number between 0 and 50?
Choices;
a. srand(time(0));
num = rand() % 50;
b. srand(time(0));
num = rand()50;
c. srand(time(10));
num = rand() % 50;
d. srand(time(10));
num = rand()/50;

Respuesta :

The statement that generates a random number between 0 and 50 is option C. srand(time(10));

num = rand() % 50;

What is the rand () and Srand () about?

When a person run the program, the same random number will be generated each time by the C++ rand() function. The srand(unsigned int seed) function is used to seed the rand() function. The pseudo-random number generation's starting point is set by the srand() function.

Note that a pseudo-random integer in the range of 0 to RAND MAX is returned by the C library function int rand(void). The default value of the constant RAND MAX is one that often varies depending on the implementation.

Therefore, one can say that RAND tends to generates a randomly generated real number higher than or equal to 0 and less than 1 that is dispersed evenly. Every time the worksheet is calculated, a fresh random real number is returned. Note: As of Excel 2010, Excel generates random numbers using the Mersenne Twister algorithm (MT19937).

Learn more about random number from

https://brainly.com/question/29612529
#SPJ1