I'm must be missing something because this sounds too easy:

Code:

ans = (((rand5()-1) / 4f)*6f) + 1;



You could reduce this down, but I left it long so you can follow the logic.

Code:

(rand5()-1) -> random number 0-4
/ 4 -> random number 0-1
* 6 -> random number 0-6
+ 1 -> random number 1-7




Conitec's Free Resources:
User Magazine || Docs and Tutorials || WIKI