I'd like to post a suggestion, even though I'm new to programming (and I've been doing Java which is slightly different)...
(Sorry if the syntax is wrong)
Just off the top of my head:
Code:
int rand7(){
int a = rand5()*rand5(); // Min = 1, Max = 25
while (7<a<1) {
int b = a - rand5()*rand5();
// If a = 1 => b = -24 to 0. If a = 25 => b = 0 to 24..
}
a = b;
}
I had to include a second variable, since I'm not sure how C++ would cope with;
a = a - rand5()*rand5();
And I'm not sure how to get that function to return, so anyway, the final answer is stored in b or a. Anyone that knows more about C++ is welcome to tidy up/comment on the code.