rand5 = function
return ceil(rnd*5)
end function
// Now, define rand7 using only rand5!
rand7 = function
while true
// first, generate a uniform number from 0-24
// (if it helps, think "two-digit base-5 number")
num = (rand5-1)*5 + rand5-1
// if that's < 21, divide by 3 to get a number 0-6 (and add 1)
if num < 21 then return floor(num/3) + 1
end while
end function
print "Here we go!"
for i in range(19)
print rand7
end for