diff --git a/outofcore/include/pcl/outofcore/impl/octree_base_node.hpp b/outofcore/include/pcl/outofcore/impl/octree_base_node.hpp index 9d064438aa0..0f49b537e45 100644 --- a/outofcore/include/pcl/outofcore/impl/octree_base_node.hpp +++ b/outofcore/include/pcl/outofcore/impl/octree_base_node.hpp @@ -44,6 +44,7 @@ // C++ #include #include +#include #include #include #include @@ -1708,7 +1709,7 @@ namespace pcl }//force the payload cache to deconstruct here //use STL random_shuffle and push back a random selection of the points onto our list - std::random_shuffle (payload_cache_within_region.begin (), payload_cache_within_region.end ()); + std::shuffle (payload_cache_within_region.begin (), payload_cache_within_region.end (), std::mt19937(std::random_device()())); size_t numpick = static_cast (percent * static_cast (payload_cache_within_region.size ()));; for (size_t i = 0; i < numpick; i++) diff --git a/recognition/include/pcl/recognition/hv/hv_go.h b/recognition/include/pcl/recognition/hv/hv_go.h index df125c38555..39fd0ae7bba 100644 --- a/recognition/include/pcl/recognition/hv/hv_go.h +++ b/recognition/include/pcl/recognition/hv/hv_go.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include @@ -178,7 +180,7 @@ namespace pcl void refresh(mets::feasible_solution& /*s*/) { - std::random_shuffle (moves_m.begin (), moves_m.end ()); + std::shuffle (moves_m.begin (), moves_m.end (), std::mt19937(std::random_device()())); } }; diff --git a/recognition/src/face_detection/face_detector_data_provider.cpp b/recognition/src/face_detection/face_detector_data_provider.cpp index 7a367c2c3a5..ce5989ef807 100644 --- a/recognition/src/face_detection/face_detector_data_provider.cpp +++ b/recognition/src/face_detection/face_detector_data_provider.cpp @@ -4,6 +4,8 @@ #include #include +#include + //Uncomment the following lines and set PCL_FACE_DETECTION_VIS_TRAINING_FDDP to 1 //to visualize the training process and change the CMakeLists.txt accordingly. //#include @@ -136,13 +138,14 @@ void pcl::face_detection::FaceDetectorDataProvider= min_images_per_bin_) { - std::random_shuffle (image_files_per_bin[i][j].begin (), image_files_per_bin[i][j].end ()); + std::shuffle (image_files_per_bin[i][j].begin (), image_files_per_bin[i][j].end (), rng); image_files_per_bin[i][j].resize (min_images_per_bin_); yaw_pitch_bins[i][j] = min_images_per_bin_; } @@ -167,8 +170,8 @@ template::getDatasetAndLabels(DataSet & data_set, std::vector & label_data, std::vector & examples) { - srand (static_cast(time (nullptr))); - std::random_shuffle (image_files_.begin (), image_files_.end ()); + std::mt19937 rng(std::random_device()()); + std::shuffle (image_files_.begin (), image_files_.end (), rng); std::vector < std::string > files; files = image_files_; files.resize (std::min (num_images_, static_cast (files.size ()))); @@ -393,8 +396,8 @@ void pcl::face_detection::FaceDetectorDataProvider