Skip to content

Commit 640c95c

Browse files
committed
chore: update random usage
Signed-off-by: STRRL <[email protected]>
1 parent e41f71e commit 640c95c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ go 1.22.3
55
require (
66
github.com/rss3-network/node v0.5.9
77
github.com/spf13/cobra v1.8.1
8-
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8
98
gopkg.in/yaml.v3 v3.0.1
109
)
1110

@@ -67,6 +66,7 @@ require (
6766
go.uber.org/multierr v1.11.0 // indirect
6867
go.uber.org/zap v1.27.0 // indirect
6968
golang.org/x/crypto v0.25.0 // indirect
69+
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
7070
golang.org/x/mod v0.17.0 // indirect
7171
golang.org/x/net v0.27.0 // indirect
7272
golang.org/x/sync v0.7.0 // indirect

pkg/cmd/cmd.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"bytes"
55
"fmt"
6+
"math/rand"
67
"os"
78
"path"
89
"strings"
@@ -11,7 +12,6 @@ import (
1112
"github.com/rss3-network/node-automated-deployer/pkg/compose"
1213
"github.com/rss3-network/node/config"
1314
"github.com/spf13/cobra"
14-
"golang.org/x/exp/rand"
1515
"gopkg.in/yaml.v3"
1616
)
1717

@@ -71,11 +71,11 @@ Then, with a single command, you create and start all the services from your con
7171
}
7272

7373
func randomString(n int) string {
74-
rand.Seed(uint64(time.Now().UnixNano()))
75-
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
74+
r := rand.New(rand.NewSource(time.Now().UnixNano()))
75+
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
7676
b := make([]byte, n)
7777
for i := range b {
78-
b[i] = letterBytes[rand.Intn(len(letterBytes))]
78+
b[i] = letterBytes[r.Intn(len(letterBytes))]
7979
}
8080
return string(b)
8181
}

0 commit comments

Comments
 (0)