I think there is an ideal solution where no random numbers are lost. It would involve running an algorithm which will produce a random number of random numbers in the range 0-6 (I'll start at zero to make the math nicer) and queue them up until when they are needed.
In the algorithm random numbers (0-4) are iteratively added to a stack. Each time one is added, the following check is made:
Let L be the length of the stack.
Let X be the base 5 number representation of the stack, eg: a stack of [2,4,0,3] = 2*125 + 4*25 + 3.
Is there a K such that [math]X < 7^K <= 5^L[/math]
?
If so we can break this loop. Now let Y be the base 7 number representation of X.
The digits of Y are our random numbers in the range of 0-6 that can be queued up for when needed (when they run out run this algorithm again).
I'm quite sure the loop will use a finite but arbitrarily large number of iterations, but am not sure how to prove it. And of course, using an arbitrary number of iterations is fine since it also outputs a correspondingly large number of 0-6 range numbers, hence nothing wasted.
In case it's hard to understand what I mean, my first post here would be what would happen on the second iteration.