Merge pull request #7258

1d1c430 p2p: fix cubic selection in filtered peer list (moneromooo)
This commit is contained in:
luigi1111 2021-04-16 12:46:34 -05:00
commit 7cf47d754c
No known key found for this signature in database
GPG key ID: F4ACA0183641E010

View file

@ -1229,8 +1229,8 @@ namespace nodetool
if(!max_index) if(!max_index)
return 0; return 0;
size_t x = crypto::rand<size_t>()%(max_index+1); size_t x = crypto::rand<size_t>()%(16*max_index+1);
size_t res = (x*x*x)/(max_index*max_index); //parabola \/ size_t res = (x*x*x)/(max_index*max_index*16*16*16); //parabola \/
MDEBUG("Random connection index=" << res << "(x="<< x << ", max_index=" << max_index << ")"); MDEBUG("Random connection index=" << res << "(x="<< x << ", max_index=" << max_index << ")");
return res; return res;
} }