From e58c223ad510db6065a7ed76cf28cc23c6badbed Mon Sep 17 00:00:00 2001 From: jinhai Date: Mon, 9 Sep 2019 12:02:31 +0000 Subject: [PATCH] Fix memory double free issue due to random_device Former-commit-id: 371a536cd0e80736d9333cff4178a6785097c87e --- cpp/src/scheduler/action/PushTaskToNeighbour.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/src/scheduler/action/PushTaskToNeighbour.cpp b/cpp/src/scheduler/action/PushTaskToNeighbour.cpp index 200f6214fe..3de0165b0f 100644 --- a/cpp/src/scheduler/action/PushTaskToNeighbour.cpp +++ b/cpp/src/scheduler/action/PushTaskToNeighbour.cpp @@ -57,8 +57,8 @@ Action::PushTaskToNeighbourRandomly(const TaskPtr &task, total_speed += speed; } - std::random_device rd; - std::mt19937 mt(rd()); + unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count(); + std::mt19937 mt(seed1); std::uniform_int_distribution dist(0, total_speed); uint64_t index = 0; int64_t rd_speed = dist(mt);