There are some crucial details to improve the scaling, to correctly deal with floating point arithmetic, and to correctly work with zero probability distributions. If we are assuming that the index i is contained in the constrained subset M , it is drawn with a probability pi = p i j∈M p j from it. The renormalization scales linearly with the number of elements in M . If M contains many elements it is advantageous to scale with the complement via j∈M p j = 1j / ∈M p j . (28) become. The difference between CDF and alias sampling is negligible for rebuilding and drawing once. If the subset fraction is 0.5, which is the usual case for balanced active spaces with equal number of spatial orbitals and particles, then redrawing is 5 to 10 times faster than rebuilding. the initialization (compare algorithm 2) against the system size n. The dotted lines are purely the sampling times while the solid lines include the sampling and construction time.