Merge branch 'branch-0.4.0' into 'branch-0.4.0'

Fix memory double free issue due to random_device

See merge request megasearch/milvus!524

Former-commit-id: 970d947cb84c3317333e7229d1d0c3259623bc71
pull/191/head
jinhai 2019-09-09 20:11:31 +08:00
commit 5c9145aeb7
1 changed files with 2 additions and 2 deletions

View File

@ -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<int> dist(0, total_speed);
uint64_t index = 0;
int64_t rd_speed = dist(mt);