`for i in xrange(n_total_samples)` is more Pythonic and should result in the same C code.