Quote:

no, the latest two both don't give equal probabilities and i think the range of returned numbers is wrong too.




why that?

Code:
unsigned short int rand7() {
static unsigned short int temp = 0;

return (temp += rand5(), temp %= 7);
}



Last edited by Joey; 10/22/07 18:27.