mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-03-09 10:36:17 +03:00
16 lines
338 B
Go
16 lines
338 B
Go
// Package crypto provides common crypto libraries for Xray.
|
|
package crypto // import "github.com/xtls/xray-core/common/crypto"
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"math/big"
|
|
)
|
|
|
|
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()
|
|
}
|