chore: simplify randBetween

This commit is contained in:
wwqgtxx 2025-08-28 09:55:03 +08:00
parent 5c73025b53
commit 45cb45accb

View File

@ -4,16 +4,16 @@ import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"errors"
"fmt"
"io"
"math/big"
"net"
"time"
"github.com/metacubex/blake3"
"github.com/metacubex/mihomo/common/pool"
"github.com/metacubex/blake3"
"github.com/metacubex/randv2"
)
type CommonConn struct {
@ -210,6 +210,5 @@ func randBetween(from int64, to int64) int64 {
if from == to {
return from
}
bigInt, _ := rand.Int(rand.Reader, big.NewInt(to-from))
return from + bigInt.Int64()
return from + randv2.Int64N(to-from)
}