Skip to content
This repository has been archived by the owner on Mar 12, 2022. It is now read-only.

Commit

Permalink
fix issue with rand.Intn
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkvist committed Jul 13, 2019
1 parent 6d297fc commit dcb4b97
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ var rootCmd = &cobra.Command{
return fmt.Errorf("while reading URLs from %q: %v", urls, err)
}

if len(sites) == 0 {
return fmt.Errorf("there is no valid URL in the file %v", urls)
}

client := &http.Client{Timeout: timeout}
sema := make(chan struct{}, goroutines)
seed := rand.NewSource(time.Now().Unix())
r := rand.New(seed)
for {
sema <- struct{}{}
i := r.Intn(len(sites) - 1)
i := r.Intn(len(sites))
s := sites[i]

go func(site string) {
Expand Down

0 comments on commit dcb4b97

Please sign in to comment.