views:

61

answers:

0

Possible Duplicate:
Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7

I was asked a simple question (purely in interest), in it there's a function which supplies a random number between 1 and 6, now with based off that function you need to make another function which makes numbers random between 1 and 10.

Now something like randtwo = randone() * randone() % 10+1 would work, but the numbers are fairly spurratic (22% possibility on one, 0 on others), what do you think is the best way to keep it suitably 'random' knowing the randone() only allows 1-6?