i am not sure about the solutions so far since i am lazy and it takes too long to fully think them through. they all seem wrong to me at a first glance.

i came up with something pretty simple now:
Code:
int rand7()
{
return (rand5()+rand5()+rand5()+rand5()+rand5() - 2) / 3;
}



the five rand5() give the range 5..25, after -2 the range will be 3..23, after the integer division by 3 it will be 1..7! or did i miss something?