aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node.inl
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-15 09:14:28 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-15 09:14:28 +0200
commit89b8ecfc7c88510681b6d354586e68510c150cda (patch)
treebd3ae35111a04d726f85fa2f9e2e36da0f23a51a /src/p2p/net_node.inl
parentMerge pull request #5369 (diff)
parentcrypto: replace rand<T>()%N idiom with unbiased rand_idx(N) (diff)
downloadmonero-89b8ecfc7c88510681b6d354586e68510c150cda.tar.xz
Merge pull request #5392
a2195b9b crypto: replace rand<T>()%N idiom with unbiased rand_idx(N) (stoffu)
Diffstat (limited to '')
-rw-r--r--src/p2p/net_node.inl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index f0aef384f..7d13b3216 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -1259,7 +1259,7 @@ namespace nodetool
}
}
else
- random_index = crypto::rand<size_t>() % filtered.size();
+ random_index = crypto::rand_idx(filtered.size());
CHECK_AND_ASSERT_MES(random_index < filtered.size(), false, "random_index < filtered.size() failed!!");
random_index = filtered[random_index];
@@ -1313,7 +1313,7 @@ namespace nodetool
return true;
size_t try_count = 0;
- size_t current_index = crypto::rand<size_t>()%m_seed_nodes.size();
+ size_t current_index = crypto::rand_idx(m_seed_nodes.size());
const net_server& server = m_network_zones.at(epee::net_utils::zone::public_).m_net_server;
while(true)
{