diff --git a/code/cards/deck.go b/code/cards/deck.go index 3243ae1..e17399b 100644 --- a/code/cards/deck.go +++ b/code/cards/deck.go @@ -3,10 +3,9 @@ package main import ( "fmt" "io/ioutil" - "math/rand" + "math/rand/v2" "os" "strings" - "time" ) // Create a new type of 'deck' @@ -60,11 +59,8 @@ func newDeckFromFile(filename string) deck { } func (d deck) shuffle() { - source := rand.NewSource(time.Now().UnixNano()) - r := rand.New(source) - for i := range d { - newPosition := r.Intn(len(d) - 1) + newPosition := rand.IntN(len(d) - 1) d[i], d[newPosition] = d[newPosition], d[i] }