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.
int ans = 0; while (ans == 0) { for (int i=0; i<3; i++) { while ((r = rand5()) == 3){}; ans += (r < 3) >> i } }