Aligned with current implementation of RandomGenerator

This commit is contained in:
Paolo Cignoni 2008-12-15 08:49:02 +00:00
parent ca3f973398
commit a9a17a0713
1 changed files with 3 additions and 5 deletions

View File

@ -98,11 +98,9 @@ public :
ScalarType one_over_n = 1.0/(ScalarType)sqrt_n_samples;
RandomGenerator rand;
MarsenneTwisterRNG rand;
SphericalHarmonics sph;
rand.initializeImprovedMarsenneTwister();
int i = 0;
for (unsigned k = 0; k < n_coeff; k++ ) sph.coefficients[k] = 0;
@ -111,8 +109,8 @@ public :
{
for (unsigned b = 0; b < sqrt_n_samples; ++b)
{
ScalarType x = (a + ScalarType(rand.generateDoubleWithImprovedMT())) * one_over_n;
ScalarType y = (b + ScalarType(rand.generateDoubleWithImprovedMT())) * one_over_n;
ScalarType x = (a + ScalarType(rand.generate01())) * one_over_n;
ScalarType y = (b + ScalarType(rand.generate01())) * one_over_n;
ScalarType theta = 2.0 * Acos(Sqrt(1.0 - x));
ScalarType phi = 2.0 * M_PI * y;