mirror of
https://github.com/Alexey71/opera-proxy.git
synced 2026-05-13 22:20:59 +00:00
24 lines
392 B
Go
24 lines
392 B
Go
|
|
package seclient
|
||
|
|
|
||
|
|
import (
|
||
|
|
crand "crypto/rand"
|
||
|
|
"math/big"
|
||
|
|
)
|
||
|
|
|
||
|
|
type secureRandomSource struct{}
|
||
|
|
|
||
|
|
var RandomSource secureRandomSource
|
||
|
|
|
||
|
|
var int63Limit = big.NewInt(0).Lsh(big.NewInt(1), 63)
|
||
|
|
|
||
|
|
func (_ secureRandomSource) Seed(_ int64) {
|
||
|
|
}
|
||
|
|
|
||
|
|
func (_ secureRandomSource) Int63() int64 {
|
||
|
|
randNum, err := crand.Int(crand.Reader, int63Limit)
|
||
|
|
if err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
return randNum.Int64()
|
||
|
|
}
|