Fixed 2 more instances of the Marsienne Twister

This commit is contained in:
nico 2021-08-24 09:26:28 +10:00
parent b1c1d03215
commit 78d98b2577
1 changed files with 7 additions and 3 deletions

View File

@ -1948,8 +1948,10 @@ static void PoissonDiskPruning(VertexSampler &ps, MeshType &montecarloMesh,
InitRadiusHandleFromQuality(montecarloMesh, rH, diskRadius, pp.radiusVariance, pp.invertQuality); InitRadiusHandleFromQuality(montecarloMesh, rH, diskRadius, pp.radiusVariance, pp.invertQuality);
//unsigned int (*p_myrandom)(unsigned int) = RandomInt; //unsigned int (*p_myrandom)(unsigned int) = RandomInt;
std::random_device rd; // std::random_device rd;
std::mt19937 g(rd()); // std::mt19937 g(rd());
// std::shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), g);
MarsenneTwisterURBG g(montecarloSHT.AllocatedCells.size());
std::shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), g); std::shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), g);
int t1 = clock(); int t1 = clock();
pp.pds.montecarloSampleNum = montecarloMesh.vn; pp.pds.montecarloSampleNum = montecarloMesh.vn;
@ -2085,7 +2087,9 @@ static void HierarchicalPoissonDisk(MeshType &origMesh, VertexSampler &ps, MeshT
// shuffle active cells // shuffle active cells
//unsigned int (*p_myrandom)(unsigned int) = RandomInt; //unsigned int (*p_myrandom)(unsigned int) = RandomInt;
std::random_device rd; std::random_device rd;
std::mt19937 g(rd()); // std::mt19937 g(rd());
// std::shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), g);
MarsenneTwisterURBG g(montecarloSHT.AllocatedCells.size());
std::shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), g); std::shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), g);
// generate a sample inside C by choosing one of the contained pre-generated samples // generate a sample inside C by choosing one of the contained pre-generated samples