From 30dfef208d859a67c1f1b13c314735861c536e85 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 3 Dec 2019 16:06:40 -0800 Subject: [PATCH] tools/osdmaptool.cc: do not use deprecated std::random_shuffle() 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 --- src/tools/osdmaptool.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/osdmaptool.cc b/src/tools/osdmaptool.cc index 5221c4f79fc..6a2f6799524 100644 --- a/src/tools/osdmaptool.cc +++ b/src/tools/osdmaptool.cc @@ -433,8 +433,8 @@ int main(int argc, const char **argv) vector 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; -- 2.39.5