Skip to content

Commit

Permalink
Fix rand.Seed deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
norrland committed Oct 12, 2023
1 parent ed86d02 commit 7840801
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,12 @@ func generateHostname() string {
"water", "resonance", "sun", "wood", "dream", "cherry", "tree", "fog",
"frost", "voice", "paper", "frog", "smoke", "star"}

rand.Seed(time.Now().UTC().UnixNano())
r := rand.New(rand.NewSource(time.Now().UTC().UnixNano()))

sections := []string{
adjectives[rand.Intn(len(adjectives))],
nouns[rand.Intn(len(nouns))],
strconv.Itoa(100 + rand.Intn(899)),
adjectives[r.Intn(len(adjectives))],
nouns[r.Intn(len(nouns))],
strconv.Itoa(100 + r.Intn(899)),
}

return strings.Join(sections, "-")
Expand Down

0 comments on commit 7840801

Please sign in to comment.