mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Use crypto/rand.Read instead of math/rand.Read
As of Go 1.20, `math/rand.Read` is deprecated. In addition to that, it also isn't recommended for use in combination with anything cryptographic. I haven't replaced all `math/rand` with `crypto/rand` imports because there are still some legitimate uses for the `math/rand` package in some places. Signed-off-by: Neil Twigg <neil@nats.io>
This commit is contained in:
@@ -18,9 +18,9 @@ package test
|
||||
|
||||
import (
|
||||
"context"
|
||||
crand "crypto/rand"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -687,7 +687,7 @@ func TestNoRaceSlowProxy(t *testing.T) {
|
||||
// Now test send BW.
|
||||
const payloadSize = 64 * 1024
|
||||
var payload [payloadSize]byte
|
||||
rand.Read(payload[:])
|
||||
crand.Read(payload[:])
|
||||
|
||||
// 5MB total.
|
||||
bytesSent := (5 * 1024 * 1024)
|
||||
|
||||
Reference in New Issue
Block a user