Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shuffle input array for sshcollector #434

Closed
stromsoe opened this issue Aug 22, 2018 · 1 comment
Closed

shuffle input array for sshcollector #434

stromsoe opened this issue Aug 22, 2018 · 1 comment

Comments

@stromsoe
Copy link

Shuffle the input array for netdisco-sshcollector. This helps to make it less likely when running multiple collectors on different devices targeting diffrent devices that they will end up stepping on each other.

sub main {
    my @input = @{ setting('sshcollector') };

    #one-line Fisher-Yates from https://www.perlmonks.org/index.pl?node=Array%20One-Liners
    my ($i,$j) = (0);
    @input[-$i,$j] = @input[$j,-$i] while $j = rand(@input - $i), ++$i < @input;
@ollyg
Copy link
Member

ollyg commented Oct 19, 2018

thanks! patch applied in 0e92744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants