Move to random_pool for shuffling (#1045)

This commit is contained in:
cryptocode 2019-01-08 20:08:09 +01:00 committed by Roy Keene
commit 4bd4d185d7
2 changed files with 3 additions and 3 deletions

View file

@ -352,7 +352,7 @@ void nano::network::broadcast_confirm_req (std::shared_ptr<nano::block> block_a)
* if the votes for a block have not arrived in time.
*/
const size_t max_endpoints = 32;
std::random_shuffle (list->begin (), list->end ());
random_pool.Shuffle (list->begin (), list->end ());
if (list->size () > max_endpoints)
{
list->erase (list->begin () + max_endpoints, list->end ());

View file

@ -103,7 +103,7 @@ std::deque<nano::endpoint> nano::peer_container::list ()
{
result.push_back (i->endpoint);
}
std::random_shuffle (result.begin (), result.end ());
random_pool.Shuffle (result.begin (), result.end ());
return result;
}
@ -126,7 +126,7 @@ std::vector<nano::peer_information> nano::peer_container::list_vector (size_t co
{
result.push_back (*i);
}
std::random_shuffle (result.begin (), result.end ());
random_pool.Shuffle (result.begin (), result.end ());
if (result.size () > count_a)
{
result.resize (count_a, nano::peer_information (nano::endpoint{}, 0));