Files
sing-box-extended-mirror/common/xray/crypto/crypto.go
T

18 lines
266 B
Go
Raw Normal View History

2025-06-08 19:35:59 +03:00
package crypto
import (
"crypto/rand"
"math/big"
)
func RandBetween(from int64, to int64) int64 {
if from == to {
return from
}
2025-12-11 02:46:57 +03:00
if from > to {
from, to = to, from
}
2025-06-08 19:35:59 +03:00
bigInt, _ := rand.Int(rand.Reader, big.NewInt(to-from))
return from + bigInt.Int64()
}