Ask Question
21 June, 15:42

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

+5
Answers (1)
  1. 21 June, 16:29
    0
    The solution code is written in C language.

    srand (seedVal); printf (" %d / n", rand () % 9); printf (" %d / n", rand () % 9);

    Explanation:

    srand () is a C library function which seeds the random number generator. The srand () function will take one unsigned integer, seedVal, as input parameter (Line 1).

    We can print random integer between (and including) 0 and 9 by calculating the random number modulus by 9 (Line 2-3). This will ensure the final random number will also be between 0 and 9.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Type a statement using srand () to seed random number generation using variable seedVal. Then type two statements using rand () to print ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers