Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Type a statement using srand() to seed random number generation using variable s

ID: 3844691 • Letter: T

Question

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 newline. Ex: 5 7
2.122 rand function: Seed and then get random numbers Type a statement using stand0 to seed random number generation using variable seedval Then type two statements using rand0 to print two random integers between (and including) and 9. End with a newline Ex Note: For this activity, using one statement may yield different output (due to the compiler calling rand0 in a dinerent order). Use two statements for this activity. Also, after calling srand0 once, do not call srand0 again (Notes) include dostream tables use rando Enables use ut tiset) 6 unt "aint) 12 x Testing with seedval 4 a 0

Explanation / Answer

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

using namespace std;

int main() {
   srand((int) time(0));
   cout << (rand() % 10) << endl;
   cout << (rand() % 10) << endl;
}

Chk this code.... This should work well... If it doesnt, please ping me. Will surly fix it in that case.