Content deleted Content added
m →Efficiency: more englishier |
→Operation: TYVM for previous fix! Improve flow by eliminating parenthetical remark. |
||
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|die]] is rolled to determine an index {{mvar|i}} into the two tables.
More concretely, the algorithm operates as follows:
Line 13:
# Otherwise, return {{mvar|K<sub>i</sub>}}.
An alternative formulation of the probability table, proposed by Marsaglia et al.<ref name=marsaglia>{{Citation |first1=George |last1=Marsaglia |author-link1=George Marsaglia |first2=Wai Wan |last2=Tsang |first3=Jingbo |last3=Wang |title=Fast Generation of Discrete Random Variables |journal=Journal of Statistical Software |date=2004-07-12 |volume=11 |issue=3 |pages=1–11 |doi=10.18637/jss.v011.i03 |doi-access=free |url=https://www.researchgate.net/publication/5142858_Fast_Generation_of_Discrete_Random_Variables/fulltext/0e5fcf01f0c404bcbfaaa888/Fast-Generation-of-Discrete-Random-Variables.pdf}}</ref> as the '''square histogram method''', avoids the computation of {{mvar|y}} by instead checking the condition {{math|1=''x'' <
==Table generation==
|