Internally, the algorithm consults two tables, a ''[[probability]] [[Table (information)|table]]'' {{mvar|U<sub>i</sub>}} and an ''alias table'' {{mvar|K<sub>i</sub>}} (for {{math|1 ≤ ''i'' ≤ ''n''}}). To generate a random outcome, a fair [[dice|diediсe]] is rolled to determine an index into the two tables. Based on the probability stored at that index, a [[biased coin]] is then flipped, and the outcome of the flip is used to choose between a result of {{mvar|i}} and {{mvar|K<sub>i</sub>}}.<ref>{{cite web |url=http://www.keithschwarz.com/darts-dice-coins/ |title=Darts, Dice, and Coins: Sampling from a Discrete Distribution |date=29 December 2011 |website=KeithSchwarz.com |access-date=2011-12-27}}</ref>
More concretely, the algorithm operates as follows: