Being confused about the example of Combining Stratified Sampling and Importance Sampling in Advanced Global Illumination (P72,P73).I know how to do importance sampling and stratified sampling. But I can't understand this example and the code.Is this example to calculate $S$ stochastically or to get a random number $u$?What is the $u$ for?What's the meaning of Sample the $i$th term of the sum $N_i$ times?
An example of Combining Stratified Sampling and Importance Sampling in AGI
sampling;importance sampling