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"
|
"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()
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user