about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-06-13T14·56+0200
committerEelco Dolstra <edolstra@gmail.com>2018-06-13T14·56+0200
commit3c5d9f478d0c0b70ec3e3100a8dacbd7437bda3e (patch)
treebd61718fa7452e7c62b8ab1e1fb32b9e7440f4b8
parent0629601da1d163a059fa19004256961f8ecdeb78 (diff)
std::random_shuffle -> std::shuffle
The former is removed in C++17.
-rw-r--r--src/libstore/gc.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 233a70bd2d2a..b5020a506beb 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -7,6 +7,7 @@
 #include <queue>
 #include <algorithm>
 #include <regex>
+#include <random>
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -832,7 +833,8 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
                alphabetically first (e.g. /nix/store/000...).  This
                matters when using --max-freed etc. */
             vector<Path> entries_(entries.begin(), entries.end());
-            random_shuffle(entries_.begin(), entries_.end());
+            std::mt19937 gen(1);
+            std::shuffle(entries_.begin(), entries_.end(), gen);
 
             for (auto & i : entries_)
                 tryToDelete(state, i);