Respuesta :
Answer:
View Image
Explanation:
No number is really ever random. It all has a seed, which is an initial value for the 'random' number to be generated. The rand() function uses an equation to generate its value, and all its 'random' value depend on the first number you plug in into your equation. The initial number you plug into your equation is what srand() do.
If you just call rand() alone without calling srand() then the generated numbers will automatically use srand(1) as a default seed. Using the same srand() value will always yield the same sequence of numbers.
To get a number between 0 and 9, take the modulus of it with 10 because modulus give you the remainder, so the number rand()%10 will never be equal to 10 or greater.
![Ver imagen GrandNecro](https://us-static.z-dn.net/files/dc7/b7dc289fd6b1373b6a5f7744e7222803.jpg)
![Ver imagen GrandNecro](https://us-static.z-dn.net/files/d60/cc567dcbd9aa90fdb5ee052eae49d7de.jpg)
rand(), srand() and seeding of values are all illustrations of generating random numbers in C++.
The first statement using srand() is:
- srand(seedVal);
The other two statements to generate and print random integers between 0 and 9 are:
- cout<<rand()%10<<endl;
- cout<<rand()%10<<endl;
The first statement
The syntax of the srand() instruction is: srand(variable);
From the question, the seeding variable is seedVal.
So, the statement that implements the srand() instruction will be:
srand(seedVal);
The other two statements
The other statements are to generate and print random numbers between 0 and 9.
The syntax to generate random numbers between intervals in C++ is:
[tex]lower + rand() \% (upper - lower + 1);[/tex]
From the question;
[tex]lower = 0\\ upper = 9[/tex]
So, we have:
[tex]0 + rand() \% (9 - 0+ 1)[/tex]
This becomes
[tex]rand() \% (10)[/tex]
The above statement represented the random number that has been generated.
Next, is to print the numbers (this is done using cout statement).
So, the two statements to print the random numbers are:
cout<<rand()%10<<endl;
cout<<rand()%10<<endl;
Read more about random numbers at:
https://brainly.com/question/16792424