Regarding simulating a 7-sided die roll with two 5-sided dice: I understand the question "Seven-sided dice from five-sided dice with finite rolls" and this answer to it. But,
Why can't you just add $\operatorname{rand}(5)+\operatorname{rand}(5)$, then discard and re-roll if the result is greater than $7$?
I understand that the worst-case runtime is $O(\infty)$, but the answer linked above also has $O(\infty)$ worst-case.
Note: This is my first stack-exchange question, so please feel free to give feedback on question-asking style.
You cannot add two $5$ rolls and then subtract off the sum to get $1$ as the minimum roll because there will be an unequal number of ways to get different results. For instance, if you sum two $5$-die rolls and then subtract $1$, there is only one way to get a final $1$ (roll 1 and roll 1). But there are two ways to get a final $2$ (roll 1 and roll 2 OR roll 2 and roll 1). It is twice as likely you'll get a final $2$ than a final $1$ by that approach.
If you allow (possibly infinite) re-rolls (as you apparently do), there are many fair methods to make a $7$-sided die from a $5$-sided one.
Here is one of the simplest, conceptually:
Method 1: Roll the $5$-sided die $7$ times in sequence and record which roll came out with the highest value (if first roll, then 1; if second roll then 2, ...). If there are ties for the maximum, then start over.
This is not very efficient, though.
Method 2: A slightly more efficient method is like the above, but if there is a tie for maximum value, then look for the sequence position where you got the minimum value, and use that as the index to the final value. If you get ties for both the maximum and the minimum, then start over.
You can do slightly better than this, with...
Method 3: As in Method 2, but if you get a tie on the maximum and on the minimum, look for the position that has the value 1 less than the maximum on the rolls (and it is not the minimum). If there are several of those, then re-start.
And you can construct ever-more complicated and slightly more efficient methods...
Method 4: Find the sequence location of a $5$. If there are none or more than $1$, then find the sequence location of a $4$. If there are none or more than $1$, the find the sequence location of a $3$.... If all this fails, start over.