I have looked on the internet for a method of simulating a die roll. I have been using this method which works quite well, but there is a chance after every try that requires me to do it over.
Basically, the method I'm using tells me to treat each coin flip as a bit to make a binary number between $0$ and $2^k$ where $k$ is the number of flips. This is certainly a fair way to simulate a die, but I occasionally have to restart when I get an outcome that is out of range.
Is there a way to simulate an $n$-sided die with a fixed number of coin tosses?
You can simulate a fair $n$-sided die with an arbitrary number of sides $n$ using a large number of fair coins, but in the general case you cannot guarantee success with a finite number of tosses.
There are a number of methods, but this one captures the key mathematical properties:
Divide $n N$ coins into $n$ groups, one for each possible value of the die. Toss all the coins and the "winner" is the group that has the most heads. Clearly this method is unbiased--each die value is equally likely to "win." You can make $N$ arbitrarily large (say $N = 10^{1000}$) so as to make the probability of a tie negligible.
Negligible... but not zero.
(There are more efficient methods--ones that take fewer tosses on average--but none that guarantee success in a finite number of tosses for an arbitrary $n$.)