codies/internal/game/rand.go

21 lines
322 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 {
2020-08-03 04:08:33 +00:00
return rand.Intn(n) //nolint:gosec
2020-05-23 21:51:11 +00:00
}
func (globalRand) Shuffle(n int, swap func(i, j int)) {
rand.Shuffle(n, swap)
}