Accept x with probability p(x)/q(x), otherwise reject x; To obtain multiple samples, the algorithm is repeated several times.
for simple bounds, Figure 1: An example of an initial q-automaton (a), and the refined q-automaton (b) Each state corresponds to a context (only state 6 has a non-empty context) and each edge represents the emission of a symbol.