Question: Program needs to be done in C. Write a function called randint that takes two int arguments/parameters and returns a random integer between the arguments
Program needs to be done in C.
Write a function called randint that takes two int arguments/parameters and returns a random integer between the arguments given. Your function should not use any global (file scope) variables. See the bullets below for ideas on how to do this well. Include a function prototype and some code to test the function in main. Make sure this function will generate unique values when called within a loop. srand can only be called once. How can a static variable in the function be used to accomplish this? Make sure the arguments used are in ascending order, return O if this is not true. Good: randint (1, 100) randint(-50, 50) randint (-100, -1) Bad: randint (100, 1) randint (50, -50) randint(-1, -100)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
