mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-12-19 16:30:07 +08:00
chore: simplify randBetween
This commit is contained in:
parent
5c73025b53
commit
45cb45accb
@ -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)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user