func (r *DefaultRand) Intn(n int) int {
	return globalRand.Intn(n)
}
Intn returns, as an int, a non-negative pseudo-random number in [0,n)
from the default Source.
package utils
import (
	crand "crypto/rand"
	"encoding/binary"
	"math/rand"
	"sync"
	"time"
)
var _ rand.Source = (*lockedSource)(nil)
var _ rand.Source64 = (*lockedSource64)(nil)
type lockedSource struct {
	mu  sync.Mutex
	src rand.Source
}
func (src *lockedSource) Int63() int64 {
	src.mu.Lock()
	defer src.mu.Unlock()
	return src.src.Int63()
}
func (src *lockedSource) Seed(seed int64) {
	src.mu.Lock()
	defer src.mu.Unlock()
	src.src.Seed(seed)
}
type lockedSource64 struct {
	mu  sync.Mutex
	src rand.Source64
}
func (src *lockedSource64) Int63() int64 {
	src.mu.Lock()
	defer src.mu.Unlock()
	return src.src.Int63()
}
func (src *lockedSource64) Uint64() uint64 {
	src.mu.Lock()
	defer src.mu.Unlock()
	return src.src.Uint64()
}
func (src *lockedSource64) Seed(seed int64) {
	src.mu.Lock()
	defer src.mu.Unlock()
	src.src.Seed(seed)
}
func newSeed() int64 {
	var seed int64
	if err := binary.Read(crand.Reader, binary.BigEndian, &seed); err != nil {
		seed = time.Now().UnixNano()
	}
	return seed
}
func newGlobalRand() *rand.Rand {
	src := rand.NewSource(newSeed())
	if src64, ok := src.(rand.Source64); ok {
		return rand.New(&lockedSource64{src: src64})
	}
	return rand.New(&lockedSource{src: src})
}
type Rand interface {
	Int63n(n int64) int64
	Intn(n int) int
	Float64() float64
}
type DefaultRand struct{}
var globalRand = newGlobalRand()
func (r *DefaultRand) Int63n(n int64) int64 {
	return globalRand.Int63n(n)
}