Question: Copy the lab 5 _ part 1 . c program to a new file, lab 5 _ part 2 . c , to use in

Copy the lab5_part1.c program to a new file, lab5_part2.c, to use in this part.We will generate random values, but they should be limited to 0,1,2, or 3. To do this, think of a way to map the random value to a small value; there are many ways to do this, however, the way you choose must be reproducible. That is, if it maps value X to the value 2, it should do that every time the value is X. Create a function that accomplishes random number generation and mapping: the function should return a single integer that is a random value of 0,1,2, or 3. It does not need any inputs. To verify that it works, have your program print about 20 from it. If your program gives you values like -1 or 4, you know you have a problem. Also, if it never generates one of the values (0,1,2, or 3), then there is a problem.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!