Alias method: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Altered url. URLs might have been anonymized. | Use this bot. Report bugs. | #UCB_CommandLine
Operation: Fixed typo
Tags: Reverted Mobile edit Mobile web edit
Line 4:
 
==Operation==
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|diedice]] is rolled to determine an index {{mvar|i}} into the two tables. A [[biased coin]] is then flipped, choosing a result of {{mvar|i}} with probability {{mvar|U<sub>i</sub>}}, or {{mvar|K<sub>i</sub>}} otherwise (probability {{math|1 − ''U<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: