I was on a game forum and I saw this question come up, I was interested on the ways that It can be accomplished so I posed it here

Apparently, NVIDIA uses this as a test question when they hire new programmers...

Quote:


Q: The function rand5() returns an integer between 1 and 5, inclusive (that's 1,2,3,4,5), with equal probability. Use rand5() to create a function called rand7() that returns an integer between 1 and 7, inclusive, with equal probability.

You must try to find the most efficient, elegant way to solve this problem.





It will be interesting to see how it can be done

Anyways, I'm off
Adoado


Visit our development blog: http://yellloh.com