00001 #ifndef _VAN_DER_CORPUT_HPP_ 00002 #define _VAN_DER_CORPUT_HPP_ 00003 00004 // Generalized Van Der Corput function 00005 float vdC(int i, int base, int** permutation) { 00006 float u, f, factor; 00007 int digit; 00008 00009 u = 0.0; 00010 f = factor = 1.0 / (float)base; 00011 00012 while(i > 0) { 00013 digit = i % base; 00014 00015 u += (float)(permutation[base-1][digit]) * factor; 00016 i /= base; 00017 factor *= f; 00018 } 00019 00020 return u; 00021 } 00022 00023 #endif