]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/osdmaptool.cc: do not use deprecated std::random_shuffle() 31990/head
authorKefu Chai <kchai@redhat.com>
Wed, 4 Dec 2019 00:06:40 +0000 (16:06 -0800)
committerDavid Zafman <dzafman@redhat.com>
Wed, 4 Dec 2019 00:06:40 +0000 (16:06 -0800)
the use of `std::random_shuffle()` was introduced by
b946308 .

in this change, it is replaced using `std::shuffle()`.

Fixes: https://tracker.ceph.com/issues/43084
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/tools/osdmaptool.cc

index 5221c4f79fc5a69e4b3f47080448b6022fd511a0..6a2f679952418cfef74ff6812297bad7bf300523 100644 (file)
@@ -433,8 +433,8 @@ int main(int argc, const char **argv)
     vector<int> rules;
     for (auto& r: pools_by_rule)
       rules.push_back(r.first);
-    srand(time(0));
-    random_shuffle (rules.begin(), rules.end());
+    std::random_device rd;
+    std::shuffle(rules.begin(), rules.end(), std::mt19937{rd()});
     if (debug) {
       for (auto& r: rules)
         cout << "rule: " << r << " " << pools_by_rule[r] << std::endl;