Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7.
just scale your output from your first function
0) you have a number in range 1-5 1) subtract 1 to make it in range 0-4 2) multiply by (7-1)/(5-1) to make it in range 0-6 3) add 1 to increment the range: Now your result is in between 1-7