chore: use fastrand to replace math/rand

This commit is contained in:
wwqgtxx
2023-03-06 18:10:14 +08:00
parent ad6336231c
commit 6a97ab9ecb
26 changed files with 109 additions and 111 deletions

View File

@ -4,8 +4,9 @@ import (
"bytes"
"errors"
"fmt"
"math/rand"
"net"
"github.com/zhangyunhao116/fastrand"
)
var (
@ -68,7 +69,7 @@ func getHeadSize(b []byte, defaultValue int) int {
func getDataLength(b []byte) int {
bLength := len(b)
dataLength := getHeadSize(b, 30) + rand.Intn(32)
dataLength := getHeadSize(b, 30) + fastrand.Intn(32)
if bLength < dataLength {
return bLength
}