mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-05-14 00:51:12 +03:00
18 lines
266 B
Go
18 lines
266 B
Go
package crypto
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"math/big"
|
|
)
|
|
|
|
func RandBetween(from int64, to int64) int64 {
|
|
if from == to {
|
|
return from
|
|
}
|
|
if from > to {
|
|
from, to = to, from
|
|
}
|
|
bigInt, _ := rand.Int(rand.Reader, big.NewInt(to-from))
|
|
return from + bigInt.Int64()
|
|
}
|