shotgun/game/rng.go

11 lines
162 B
Go

package game
import "math/rand/v2"
func shuffle[E any, S ~[]E](s S) {
for i := len(s) - 1; i > 0; i-- {
j := rand.IntN(i + 1)
s[i], s[j] = s[j], s[i]
}
}