mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-05 13:37:30 +00:00
chore: simplify randBetween
This commit is contained in:
@@ -4,16 +4,16 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
"crypto/rand"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"math/big"
|
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/metacubex/blake3"
|
|
||||||
"github.com/metacubex/mihomo/common/pool"
|
"github.com/metacubex/mihomo/common/pool"
|
||||||
|
|
||||||
|
"github.com/metacubex/blake3"
|
||||||
|
"github.com/metacubex/randv2"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CommonConn struct {
|
type CommonConn struct {
|
||||||
@@ -210,6 +210,5 @@ func randBetween(from int64, to int64) int64 {
|
|||||||
if from == to {
|
if from == to {
|
||||||
return from
|
return from
|
||||||
}
|
}
|
||||||
bigInt, _ := rand.Int(rand.Reader, big.NewInt(to-from))
|
return from + randv2.Int64N(to-from)
|
||||||
return from + bigInt.Int64()
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user