Quote:

Code:
int rand7()
{
float r7=0;

for(int i=0; i<7; i++)
{
r7+=rand5();
}

return int((r7/7)*2);
}



This ought to work unless I'm deluding myself.. however its probably not very elegant.. like all my code




you said earlier that this wouldnt work because *2 makes 1 impossible, what about if we modificate it a bit like this:

Code:
int rand7()
{
float r7=0;

for(int i=0; i<8; i++)
{
r7+=rand5();
}

return int(((r7/8)*2)-1);
}



wouldn't that work?


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku