diff options
Diffstat (limited to 'src/p2p/net_peerlist.h')
-rw-r--r-- | src/p2p/net_peerlist.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/p2p/net_peerlist.h b/src/p2p/net_peerlist.h index 9af3694b6..de0f51cc3 100644 --- a/src/p2p/net_peerlist.h +++ b/src/p2p/net_peerlist.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2016, The Monero Project +// Copyright (c) 2014-2017, The Monero Project // // All rights reserved. // @@ -446,13 +446,10 @@ namespace nodetool return false; } - size_t x = crypto::rand<size_t>() % (m_peers_gray.size() + 1); - size_t res = (x * x * x) / (m_peers_gray.size() * m_peers_gray.size()); //parabola \/ - - LOG_PRINT_L3("Random gray peer index=" << res << "(x="<< x << ", max_index=" << m_peers_gray.size() << ")"); + size_t random_index = crypto::rand<size_t>() % m_peers_gray.size(); peers_indexed::index<by_time>::type& by_time_index = m_peers_gray.get<by_time>(); - pe = *epee::misc_utils::move_it_backward(--by_time_index.end(), res); + pe = *epee::misc_utils::move_it_backward(--by_time_index.end(), random_index); return true; |