Function CorputBaseb(b As Long, N As Long) As Double ' Returns the equivalent first van der Corput sequence number (used in Halton, Faure, Sobol) ' b is the base X ' n is the number to be transformed Dim c As Double, ib As Double Dim i As Long, n1 As Long, n2 As Long n1 = N c = 0 ib = 1 / b Do While n1 > 0 n2 = Int(n1 / b) i = n1 - n2 * b c = c + ib * i ib = ib / b n1 = n2 Loop CorputBaseb = c End Function