Merge pull request #7258
1d1c430
p2p: fix cubic selection in filtered peer list (moneromooo)
This commit is contained in:
commit
7cf47d754c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue