diff --git a/cmake/FloatTetwildDownloadExternal.cmake b/cmake/FloatTetwildDownloadExternal.cmake index 965e2592..92d77afe 100644 --- a/cmake/FloatTetwildDownloadExternal.cmake +++ b/cmake/FloatTetwildDownloadExternal.cmake @@ -75,16 +75,16 @@ endfunction() ## fmt function(float_tetwild_download_fmt) float_tetwild_download_project(fmt - URL https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz - URL_MD5 1015bf3ff2a140dfe03de50ee2469401 + GIT_REPOSITORY https://github.com/fmtlib/fmt + GIT_TAG 40626af88bd7df9a5fb80be7b25ac85b122d6c21 ) endfunction() ## spdlog function(float_tetwild_download_spdlog) float_tetwild_download_project(spdlog - URL https://github.com/gabime/spdlog/archive/v1.3.1.tar.gz - URL_MD5 3c17dd6983de2a66eca8b5a0b213d29f + GIT_REPOSITORY https://github.com/gabime/spdlog + GIT_TAG 6fa36017cfd5731d617e1a934f0e5ea9c4445b13 ) endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 32d984a2..03bf6a5d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,6 +55,8 @@ set(SOURCES Types.hpp Statistics.h + + RandomSource.h ) prepend_current_path(SOURCES) diff --git a/src/RandomSource.h b/src/RandomSource.h new file mode 100644 index 00000000..0bbcefd7 --- /dev/null +++ b/src/RandomSource.h @@ -0,0 +1,14 @@ +// This file is part of fTetWild, a software for generating tetrahedral meshes. +// +// Copyright (C) 2019 Yixin Hu +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. +// + +#ifndef FLOATTETWILD_RANDOMSOURCE_H +#define FLOATTETWILD_RANDOMSOURCE_H + +std::random_device rd; + +#endif //FLOATTETWILD_RANDOMSOURCE_H diff --git a/src/TriangleInsertion.cpp b/src/TriangleInsertion.cpp index 4f34985f..8c2ba31a 100644 --- a/src/TriangleInsertion.cpp +++ b/src/TriangleInsertion.cpp @@ -21,6 +21,8 @@ #include //fortest +#include // for rd + #include #include #include @@ -34,6 +36,7 @@ #include #endif +#include #include #include #include @@ -140,7 +143,9 @@ void floatTetWild::sort_input_faces(const std::vector &input_vertices, if (mesh.params.not_sort_input) return; - std::random_shuffle(sorted_f_ids.begin(), sorted_f_ids.end()); + std::mt19937 g(rd()); // Standard mersenne_twister_engine seeded with rd() + + std::shuffle(sorted_f_ids.begin(), sorted_f_ids.end(), g); // std::sort(sorted_f_ids.begin(), sorted_f_ids.end(), [&weights](int a, int b) { // return weights[a] < weights[b]; // });