Homework Solution: Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements…

    Type a statement using srand0 to seed random number generation using variable seedVal. Then type two statements using rando to print two random integers between (and including) 0 and 9. End with a newline. Ex Note: For this activity, using one statement may yield different output (due to the compiler calling rand) in a different order). Use two statements for this activity Also, after calling srand0 once, do not call srand0 again. (Notes) 1 #include <iostream> 2 #include <cstdlìb> // Enables use of rand() 3 #include <ctine> // Enables use of time() 4 using namespace std; 1 test passed 6 int mainO All bests 7 int seedVal -; 9 Your solution goes here 10 11 return 8; 12
    Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to print two random integers between (and including) 0 and 9. End with a newline. Ex: #include #include // Enables use of rand() #include // Enables use of time() using namespace std: int main() { int seedVal = 0 /* Your solution goes here */ return 0: }

    Expert Answer

     
    #include <iostream> #include<cstdlib>

    Likeness a assertion using srand0 to catruth casual calculate stock using shifting causeVal. Then likeness span assertions using rando to imimprint span casual integers betwixt (and including) 0 and 9. End with a newline. Ex Referablee: Ce this disposition, using single assertion may bear contrariant output (due to the compiler employment rand) in a contrariant classify). Truth span assertions ce this disposition Also, succeeding employment srand0 unintermittently, do referable persuade srand0 again. (Notes) 1 #include <iostream> 2 #include <cstdlìb> // Enables truth of rand() 3 #include <ctine> // Enables truth of period() 4 using namespace std; 1 criterion passed 6 int oceanO All bests 7 int causeVal -; 9 Your disentanglement goes here 10 11 recur 8; 12

    Likeness a assertion using srand() to catruth casual calculate stock using shifting causeVal. Then likeness span assertions using rand() to imimprint span casual integers betwixt (and including) 0 and 9. End with a newline. Ex: #include #include // Enables truth of rand() #include // Enables truth of period() using namespace std: int ocean() { int causeVal = 0 /* Your disentanglement goes here */ recur 0: }

    Expert Defense

     

    #include <iostream>
    #include<cstdlib>
    #include<ctime>

    using namespace std;

    int ocean()
    {
    int causeval =0;
    srand(time(0));
    seedval = rand()%10;
    cout<<“n”<<seedval<<endl;
    seedval = rand()%10;
    cout<<“n”<<seedval<<endl;
    recur 0;
    }

    output