In Figure we see that there is a trade-off between optimizing for construction or sampling time. For this reason we now assume that we optimize for sampling when the sampler is initialized once and then often sampled, while we optimize for construction, if the alias sampler should be constructed often. Now we can turn our eyes towards an efficient algorithm for sampling from a constrained subset of an already constructed alias sampler. The main idea (algorithm 3) is to just sample via existing alias tables until the sampled index is contained in the subset. Since the alias sampling is so fast, this is usually faster than rebuilding alias or CDF tables for the constrained subsets.