From 78d98b25770e5f9f1c5bb93e15f90a0642aafab5 Mon Sep 17 00:00:00 2001 From: nico Date: Tue, 24 Aug 2021 09:26:28 +1000 Subject: [PATCH] Fixed 2 more instances of the Marsienne Twister --- vcg/complex/algorithms/point_sampling.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vcg/complex/algorithms/point_sampling.h b/vcg/complex/algorithms/point_sampling.h index 1ef40d61..4bd163c0 100644 --- a/vcg/complex/algorithms/point_sampling.h +++ b/vcg/complex/algorithms/point_sampling.h @@ -1948,8 +1948,10 @@ static void PoissonDiskPruning(VertexSampler &ps, MeshType &montecarloMesh, InitRadiusHandleFromQuality(montecarloMesh, rH, diskRadius, pp.radiusVariance, pp.invertQuality); //unsigned int (*p_myrandom)(unsigned int) = RandomInt; - std::random_device rd; - std::mt19937 g(rd()); +// std::random_device 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); int t1 = clock(); pp.pds.montecarloSampleNum = montecarloMesh.vn; @@ -2085,7 +2087,9 @@ static void HierarchicalPoissonDisk(MeshType &origMesh, VertexSampler &ps, MeshT // shuffle active cells //unsigned int (*p_myrandom)(unsigned int) = RandomInt; 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); // generate a sample inside C by choosing one of the contained pre-generated samples