How can I effectively combine multiple discrete uniform distributions of a limited range to achieve a discrete uniform distribution of a large range? I.e. given $unif\{a,b\}$ generate $unif\{a,c\}, c>b$.
As an example, say I have a 37-sided die (dice), but really need uniform values from 1 to 59. (Primes chosen intentionally.) Obviously summing multiple values to match or extend beyond the desired range (modulus the desired range) would result in a Gaussian distribution.
My CS-based approach is to convert the original to a binary function, and apply repeatedly to generate a binary number in the desired range (discarding exceptional values in each stage). For my example, treat 1-18 as zero, 19-36 as one, and discard 37; repeat 6 times to generate a 6-digit binary, add 1, discarding resultant values 60-64. Obviously the logical extension to this is to divide the original range into multiple bits, i.e. generate $\lfloor\log_2(n)\rfloor$ bits for each value in the original $n$ range.
My question essentially, is there a better, more mathematically-sound approach?
For simplicity I'll assume that the numbers on the dice start with $0$.
Roll the $37$-sided die twice, with results $a$ and $b$, and calculate $37a+b$. Repeat until you get a number below $23\cdot59=1357$ (the highest multiple of $59$ below $37^2=1369$). Then use $37a+b\bmod 59$. The expected number of rolls required is $\frac2{1357/1369}=\frac{2738}{1357}\approx2.02$.