mirror of https://github.com/status-im/nim-eth.git
fix deprecated 'rand' (#259)
This commit is contained in:
parent
61feae0f21
commit
0424a66aa2
|
@ -496,9 +496,9 @@ proc randomNodes*(k: KademliaProtocol, count: int): seq[Node] =
|
||||||
# insignificant compared to the time it takes for the network roundtrips when connecting
|
# insignificant compared to the time it takes for the network roundtrips when connecting
|
||||||
# to nodes.
|
# to nodes.
|
||||||
while len(seen) < count:
|
while len(seen) < count:
|
||||||
let bucket = k.routing.buckets.rand()
|
let bucket = k.routing.buckets.sample()
|
||||||
if bucket.nodes.len != 0:
|
if bucket.nodes.len != 0:
|
||||||
let node = bucket.nodes.rand()
|
let node = bucket.nodes.sample()
|
||||||
if node notin seen:
|
if node notin seen:
|
||||||
result.add(node)
|
result.add(node)
|
||||||
seen.incl(node)
|
seen.incl(node)
|
||||||
|
|
Loading…
Reference in New Issue