codies/internal/game/rand.go

21 lines
307 B
Go
Raw Normal View History

2020-05-23 21:51:11 +00:00
package game
import "math/rand"
type Rand interface {
Intn(n int) int
Shuffle(n int, swap func(i, j int))
}
type globalRand struct{}
var _ Rand = globalRand{}
func (globalRand) Intn(n int) int {
return rand.Intn(n)
}
func (globalRand) Shuffle(n int, swap func(i, j int)) {
rand.Shuffle(n, swap)
}