Question: a) Write a program in C that determines how many calls to a random number generator it takes to match a number between 0 and
a) Write a program in C that determines how many calls to a random number generator it takes to match a number between 0 and 99 that is entered by a user. Use a seeded random number generation function; otherwise all iterations of the outer loop (part b below) will be the same. b) Embed the above program in a second loop that makes this computation 50 times and prints out the average number of times that the program took to find a match for the number entered. Musts: 1) You must use at least two nested (embedded) loops. 2) You must use a seeded random number generator. 3) The output average of times the inner loop ran must be a floating point number. 4) Lastly (and obviously!), your program must be written in C and must compile and execute correctly from Code::Blocks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
