2024-01-20 22:06:56 -06:00
|
|
|
package game
|
|
|
|
|
2024-04-07 15:14:57 -05:00
|
|
|
import "math/rand/v2"
|
2024-01-20 22:06:56 -06:00
|
|
|
|
2024-04-07 15:14:57 -05:00
|
|
|
func shuffle[E any, S ~[]E](s S) {
|
2024-01-20 22:06:56 -06:00
|
|
|
for i := len(s) - 1; i > 0; i-- {
|
2024-04-07 15:14:57 -05:00
|
|
|
j := rand.IntN(i + 1)
|
2024-01-20 22:06:56 -06:00
|
|
|
s[i], s[j] = s[j], s[i]
|
|
|
|
}
|
|
|
|
}
|