23 lines
380 B
Go
23 lines
380 B
Go
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)
|
|
}
|
|
return int64(value & ^uint64(1<<63))
|
|
}
|
|
|
|
func (cryptoSource) Seed(seed int64) {}
|