helium / erlang-libp2p

An Erlang implementation of libp2p swarms
https://helium.github.io/erlang-libp2p
Apache License 2.0
121 stars 34 forks source link

Possibly skipping first peer when randomly selecting #434

Open antonyscerri opened 2 years ago

antonyscerri commented 2 years ago

Hi

New to erlang so excuse me if I have misinterpreted this.

This line and the subsequent few look like it may be skipping the first peer in the list (when there is more than one).

https://github.com/helium/erlang-libp2p/blob/master/src/peerbook/libp2p_peerbook.erl#L229

If uniform picks from 1 to N inclusive and is then added to the start position it means it can never begin with that initial point.

Thanks

Tony