diff --git a/plugin/client.go b/plugin/client.go index 28ccbf1..cd3a852 100644 --- a/plugin/client.go +++ b/plugin/client.go @@ -8,9 +8,10 @@ package plugin import ( "bufio" + "crypto/rand" "fmt" "io" - "math/rand" + mathrand "math/rand/v2" "os" "path/filepath" "strconv" @@ -468,15 +469,15 @@ func writeStanzaWithBody(conn io.Writer, t string, body []byte) error { } func writeGrease(conn io.Writer) (sent bool, err error) { - if rand.Intn(3) == 0 { + if mathrand.IntN(3) == 0 { return false, nil } - s := &format.Stanza{Type: fmt.Sprintf("grease-%x", rand.Int())} - for i := 0; i < rand.Intn(3); i++ { - s.Args = append(s.Args, fmt.Sprintf("%d", rand.Intn(100))) + s := &format.Stanza{Type: fmt.Sprintf("grease-%x", mathrand.Int())} + for i := 0; i < mathrand.IntN(3); i++ { + s.Args = append(s.Args, fmt.Sprintf("%d", mathrand.IntN(100))) } - if rand.Intn(2) == 0 { - s.Body = make([]byte, rand.Intn(100)) + if mathrand.IntN(2) == 0 { + s.Body = make([]byte, mathrand.IntN(100)) rand.Read(s.Body) } return true, s.Marshal(conn)