Forráskód Böngészése

Use std::shuffle instead of std::random_shuffle

Yucheol Jung 6 éve
szülő
commit
b1c29bcef5
1 módosított fájl, 4 hozzáadás és 1 törlés
  1. 4 1
      include/igl/randperm.cpp

+ 4 - 1
include/igl/randperm.cpp

@@ -8,6 +8,7 @@
 #include "randperm.h"
 #include "colon.h"
 #include <algorithm> 
+#include <random>
 
 template <typename DerivedI>
 IGL_INLINE void igl::randperm(
@@ -17,7 +18,9 @@ IGL_INLINE void igl::randperm(
   Eigen::VectorXi II;
   igl::colon(0,1,n-1,II);
   I = II;
-  std::random_shuffle(I.data(),I.data()+n);
+  std::random_device rd;
+  std::mt19937 mt(rd());
+  std::random(I.data(),I.data()+n, mt);
 }
 
 #ifdef IGL_STATIC_LIBRARY