This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
2019-11-27 09:07:48 +07:00
|
|
|
package gacha
|
|
|
|
|
|
|
|
import (
|
|
|
|
crand "crypto/rand"
|
|
|
|
"encoding/binary"
|
|
|
|
mrand "math/rand"
|
|
|
|
)
|
|
|
|
|
|
|
|
var rand = mrand.New(cryptoSource{})
|
|
|
|
|
|
|
|
type cryptoSource struct{}
|
|
|
|
|
|
|
|
func (cryptoSource) Int63() int64 {
|
|
|
|
var value uint64
|
|
|
|
err := binary.Read(crand.Reader, binary.BigEndian, &value)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2019-11-28 04:11:06 +07:00
|
|
|
return int64(value & ^uint64(1<<63))
|
2019-11-27 09:07:48 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (cryptoSource) Seed(seed int64) {}
|