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.
Why not do it simple?
int random7() { return random5() + (random5() % 3); }
The chances of getting 1 and 7 in this solution is lower due to the modulo, however, if you just want a quick and readable solution, this is the way to go.