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

@ -5,11 +5,11 @@ package congestion
import (
"fmt"
"math"
"math/rand"
"net"
"time"
"github.com/metacubex/quic-go/congestion"
"github.com/zhangyunhao116/fastrand"
)
const (
@ -780,7 +780,7 @@ func (b *bbrSender) EnterProbeBandwidthMode(now time.Time) {
// Pick a random offset for the gain cycle out of {0, 2..7} range. 1 is
// excluded because in that case increased gain and decreased gain would not
// follow each other.
b.cycleCurrentOffset = rand.Int() % (GainCycleLength - 1)
b.cycleCurrentOffset = fastrand.Int() % (GainCycleLength - 1)
if b.cycleCurrentOffset >= 1 {
b.cycleCurrentOffset += 1
}