Random number 1..5 to 1..7 int rand7() { int x = 22; while( x > 21) x = rand5() + 5*rand5() - 5; int...

Please Visit: http://ift.tt/1ajReyV



Random number 1..5 to 1..7

int rand7()

{

int x = 22;

while( x > 21)

x = rand5() + 5*rand5() - 5;

int r = 1 + (x % 7);

return r;

}

http://ift.tt/1rWeLTY

http://ift.tt/1k7XyiN



Random number 1..5 to 1..7







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1k7XyiR

via LifeLong Community

No comments:

Post a Comment