Let's say you have two cube with 255 sides and you have to use them to simulate a single cube with 256 sides, how can I do it?
$f(n)$ and $g(n)$ returns random number between 1 and 255. I thought about: (Sorry for my programming background)
if $f(n) = g(n)$ then $h(n) = f(n) + 1$ else $h(n) = f(n)$, but it's wrong because it will have the first side to have about $1/256$ chance and it carries that $1/255/255$ to the next side (which makes them all $1/255$ and is wrong) every-time and the last will have $1/255/255$. Is there a way to make my way work? Or is there something else?
$(255(f(n)-1)+g(n)-1)\,\mathrm{mod}\,256+1$ also is close but not perfect, as Ross Millikan says, you need to reroll if the distribution is supposed to be perfect, afaik.