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

Type a statement using srand0 to seed random number generation using variable se

ID: 2267930 • Letter: T

Question

Type a statement using srand0 to seed random number generation using variable seedVal. Then type two statements using rand 0 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 rand0 in a different order). Use two statements for this activity. Also, after calling srand0 once, do not call srand0 again. (Notes) 1 includestdio.h> 2 #include stdlib.h> 3 #include // Enables use of rand() // Enables use of tine() 5 int main(void) ( 6 int seedVal; passed 9 18 int i randnum; int seedVal n time(e); 11 srand(seedval): 12 13 return 8 14 )

Explanation / Answer

#include <stdio.h>

#include <stdlib.h>

#include <timee.h.

int main(void){

         int seedVal;

         scanf ("%d",&seedVal);

         printf ("First Random number from 0 to 9 is : %d ", rand()%10);

         srand (seedVal);

         printf ("Second Random number from 0 to 9 is : %d ", rand()%10);

         return 0;

}