From 4bccf9d0092e71cb9a4b43e4fe3abef62c9ac373 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 12 Sep 2024 01:03:53 +0900 Subject: [PATCH] all: use math/rand/v2 --- audio/internal/convert/float32_test.go | 4 ++-- audio/internal/convert/stereof32_test.go | 2 +- audio/internal/convert/stereoi16_test.go | 6 +++--- examples/2048/2048/game.go | 7 ------- examples/2048/2048/tile.go | 6 +++--- examples/blocks/blocks/gamescene.go | 9 ++------- examples/chipmunk/main.go | 2 +- examples/doomfire/main.go | 7 ++----- examples/drag/main.go | 11 +++-------- examples/flappy/main.go | 9 ++------- examples/font/main.go | 15 +++++---------- examples/isometric/level.go | 8 ++------ examples/life/main.go | 11 +++-------- examples/mascot/main.go | 11 +++-------- examples/particles/main.go | 11 +++-------- examples/set/main.go | 17 ++++++----------- examples/snake/main.go | 11 +++-------- examples/sprites/main.go | 8 ++++---- examples/spriteshd/main.go | 8 ++++---- examples/squiral/main.go | 19 +++++++------------ examples/stars/main.go | 4 +--- examples/windowsize/main.go | 10 ++++------ image_test.go | 9 ++------- internal/affine/colorm_test.go | 2 +- 24 files changed, 67 insertions(+), 140 deletions(-) diff --git a/audio/internal/convert/float32_test.go b/audio/internal/convert/float32_test.go index 8d48e33fc..658571961 100644 --- a/audio/internal/convert/float32_test.go +++ b/audio/internal/convert/float32_test.go @@ -17,7 +17,7 @@ package convert_test import ( "bytes" "io" - "math/rand" // TODO: Use math/rand/v2 when the minimum supported version becomes Go 1.22. + "math/rand/v2" "testing" "unsafe" @@ -27,7 +27,7 @@ import ( func randInt16s(n int) []int16 { r := make([]int16, n) for i := range r { - r[i] = int16(rand.Intn(1<<16) - (1 << 15)) + r[i] = int16(rand.IntN(1<<16) - (1 << 15)) } return r } diff --git a/audio/internal/convert/stereof32_test.go b/audio/internal/convert/stereof32_test.go index e992e510c..e1dfd8fad 100644 --- a/audio/internal/convert/stereof32_test.go +++ b/audio/internal/convert/stereof32_test.go @@ -19,7 +19,7 @@ import ( "fmt" "io" "math" - "math/rand" // TODO: Use math/rand/v2 when the minimum supported version becomes Go 1.22. + "math/rand/v2" "testing" "github.com/hajimehoshi/ebiten/v2/audio/internal/convert" diff --git a/audio/internal/convert/stereoi16_test.go b/audio/internal/convert/stereoi16_test.go index fe5c746a0..f5338e10c 100644 --- a/audio/internal/convert/stereoi16_test.go +++ b/audio/internal/convert/stereoi16_test.go @@ -17,8 +17,8 @@ package convert_test import ( "bytes" "fmt" - "io" // TODO: Use math/rand/v2 when the minimum supported version becomes Go 1.22. - "math/rand" + "io" + "math/rand/v2" "testing" "github.com/hajimehoshi/ebiten/v2/audio/internal/convert" @@ -101,7 +101,7 @@ func TestStereoI16(t *testing.T) { func randBytes(n int) []byte { r := make([]byte, n) for i := range r { - r[i] = byte(rand.Intn(256)) + r[i] = byte(rand.IntN(256)) } return r } diff --git a/examples/2048/2048/game.go b/examples/2048/2048/game.go index dcb1ec482..d4f53589c 100644 --- a/examples/2048/2048/game.go +++ b/examples/2048/2048/game.go @@ -15,16 +15,9 @@ package twenty48 import ( - "math/rand" - "time" - "github.com/hajimehoshi/ebiten/v2" ) -func init() { - rand.Seed(time.Now().UnixNano()) -} - const ( ScreenWidth = 420 ScreenHeight = 600 diff --git a/examples/2048/2048/tile.go b/examples/2048/2048/tile.go index fe44e8f94..0c1d04881 100644 --- a/examples/2048/2048/tile.go +++ b/examples/2048/2048/tile.go @@ -19,7 +19,7 @@ import ( "errors" "image/color" "log" - "math/rand" + "math/rand/v2" "sort" "strconv" @@ -261,9 +261,9 @@ func addRandomTile(tiles map[*Tile]struct{}, size int) error { if len(availableCells) == 0 { return errors.New("twenty48: there is no space to add a new tile") } - c := availableCells[rand.Intn(len(availableCells))] + c := availableCells[rand.IntN(len(availableCells))] v := 2 - if rand.Intn(10) == 0 { + if rand.IntN(10) == 0 { v = 4 } x := c % size diff --git a/examples/blocks/blocks/gamescene.go b/examples/blocks/blocks/gamescene.go index 19e0d206d..cc8647378 100644 --- a/examples/blocks/blocks/gamescene.go +++ b/examples/blocks/blocks/gamescene.go @@ -20,9 +20,8 @@ import ( "image/color" _ "image/jpeg" _ "image/png" - "math/rand" + "math/rand/v2" "strconv" - "time" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/colorm" @@ -139,10 +138,6 @@ type GameScene struct { gameover bool } -func init() { - rand.Seed(time.Now().UnixNano()) -} - func NewGameScene() *GameScene { return &GameScene{ field: &Field{}, @@ -194,7 +189,7 @@ const ( func (s *GameScene) choosePiece() *Piece { num := int(BlockTypeMax) - blockType := BlockType(rand.Intn(num) + 1) + blockType := BlockType(rand.IntN(num) + 1) return Pieces[blockType] } diff --git a/examples/chipmunk/main.go b/examples/chipmunk/main.go index 8912ec112..f9bf85e43 100644 --- a/examples/chipmunk/main.go +++ b/examples/chipmunk/main.go @@ -18,7 +18,7 @@ import ( "fmt" "image/color" "log" - "math/rand" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/ebitenutil" diff --git a/examples/doomfire/main.go b/examples/doomfire/main.go index e27e333db..d756e860a 100644 --- a/examples/doomfire/main.go +++ b/examples/doomfire/main.go @@ -17,8 +17,7 @@ package main import ( "image/color" "log" - "math/rand" - "time" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" ) @@ -102,7 +101,7 @@ func (g *Game) updateFireIntensityPerPixel(currentPixelIndex int) { return } - d := rand.Intn(3) + d := rand.IntN(3) newI := int(g.indices[below]) - d if newI < 0 { newI = 0 @@ -139,8 +138,6 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) { } func main() { - rand.Seed(time.Now().UnixNano()) - ebiten.SetWindowSize(screenWidth*6, screenHeight*6) ebiten.SetWindowTitle("Doom Fire (Ebitengine Demo)") if err := ebiten.RunGame(NewGame()); err != nil { diff --git a/examples/drag/main.go b/examples/drag/main.go index 8af91c3ef..e2475e88c 100644 --- a/examples/drag/main.go +++ b/examples/drag/main.go @@ -20,8 +20,7 @@ import ( "image/color" _ "image/png" "log" - "math/rand" - "time" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/ebitenutil" @@ -29,10 +28,6 @@ import ( "github.com/hajimehoshi/ebiten/v2/inpututil" ) -func init() { - rand.Seed(time.Now().UnixNano()) -} - const ( screenWidth = 640 screenHeight = 480 @@ -196,8 +191,8 @@ func NewGame() *Game { s := &Sprite{ image: ebitenImage, alphaImage: ebitenAlphaImage, - x: rand.Intn(screenWidth - w), - y: rand.Intn(screenHeight - h), + x: rand.IntN(screenWidth - w), + y: rand.IntN(screenHeight - h), } sprites = append(sprites, s) } diff --git a/examples/flappy/main.go b/examples/flappy/main.go index 186ea2002..7ca80406a 100644 --- a/examples/flappy/main.go +++ b/examples/flappy/main.go @@ -24,8 +24,7 @@ import ( _ "image/png" "log" "math" - "math/rand" - "time" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/audio" @@ -44,10 +43,6 @@ var flagCRT = flag.Bool("crt", false, "enable the CRT effect") //go:embed crt.go var crtGo []byte -func init() { - rand.Seed(time.Now().UnixNano()) -} - func floorDiv(x, y int) int { d := x / y if d*y == x || x >= 0 { @@ -150,7 +145,7 @@ func (g *Game) init() { g.cameraY = 0 g.pipeTileYs = make([]int, 256) for i := range g.pipeTileYs { - g.pipeTileYs[i] = rand.Intn(6) + 2 + g.pipeTileYs[i] = rand.IntN(6) + 2 } if g.audioContext == nil { diff --git a/examples/font/main.go b/examples/font/main.go index 1048c40ac..374447466 100644 --- a/examples/font/main.go +++ b/examples/font/main.go @@ -19,8 +19,7 @@ import ( "fmt" "image/color" "log" - "math/rand" - "time" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/examples/resources/fonts" @@ -94,10 +93,6 @@ func init() { mplusFaceSource = s } -func init() { - rand.Seed(time.Now().UnixNano()) -} - type Game struct { counter int kanjiText string @@ -110,14 +105,14 @@ func (g *Game) Update() error { g.kanjiText = "" for j := 0; j < 6; j++ { for i := 0; i < 12; i++ { - g.kanjiText += string(jaKanjis[rand.Intn(len(jaKanjis))]) + g.kanjiText += string(jaKanjis[rand.IntN(len(jaKanjis))]) } g.kanjiText += "\n" } - g.kanjiTextColor.R = 0x80 + uint8(rand.Intn(0x7f)) - g.kanjiTextColor.G = 0x80 + uint8(rand.Intn(0x7f)) - g.kanjiTextColor.B = 0x80 + uint8(rand.Intn(0x7f)) + g.kanjiTextColor.R = 0x80 + uint8(rand.IntN(0x7f)) + g.kanjiTextColor.G = 0x80 + uint8(rand.IntN(0x7f)) + g.kanjiTextColor.B = 0x80 + uint8(rand.IntN(0x7f)) g.kanjiTextColor.A = 0xff } g.counter++ diff --git a/examples/isometric/level.go b/examples/isometric/level.go index 1f0539af4..56fd32ea6 100644 --- a/examples/isometric/level.go +++ b/examples/isometric/level.go @@ -16,8 +16,7 @@ package main import ( "fmt" - "math/rand" - "time" + "math/rand/v2" ) // Level represents a Game level. @@ -56,9 +55,6 @@ func NewLevel() (*Level, error) { return nil, fmt.Errorf("failed to load embedded spritesheet: %s", err) } - // Generate a unique permutation each time. - r := rand.New(rand.NewSource(time.Now().UTC().UnixNano())) - // Fill each tile with one or more sprites randomly. l.tiles = make([][]*Tile, l.h) for y := 0; y < l.h; y++ { @@ -66,7 +62,7 @@ func NewLevel() (*Level, error) { for x := 0; x < l.w; x++ { t := &Tile{} isBorderSpace := x == 0 || y == 0 || x == l.w-1 || y == l.h-1 - val := r.Intn(1000) + val := rand.IntN(1000) switch { case isBorderSpace || val < 275: t.AddSprite(ss.Wall) diff --git a/examples/life/main.go b/examples/life/main.go index dfa773973..bdc94de35 100644 --- a/examples/life/main.go +++ b/examples/life/main.go @@ -8,16 +8,11 @@ package main import ( "log" - "math/rand" - "time" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" ) -func init() { - rand.Seed(time.Now().UnixNano()) -} - // World represents the game state. type World struct { area []bool @@ -39,8 +34,8 @@ func NewWorld(width, height int, maxInitLiveCells int) *World { // init inits world with a random state. func (w *World) init(maxLiveCells int) { for i := 0; i < maxLiveCells; i++ { - x := rand.Intn(w.width) - y := rand.Intn(w.height) + x := rand.IntN(w.width) + y := rand.IntN(w.height) w.area[y*w.width+x] = true } } diff --git a/examples/mascot/main.go b/examples/mascot/main.go index a9efaeab1..5c51cf984 100644 --- a/examples/mascot/main.go +++ b/examples/mascot/main.go @@ -21,8 +21,7 @@ import ( "image" _ "image/png" "log" - "math/rand" - "time" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" rmascot "github.com/hajimehoshi/ebiten/v2/examples/resources/images/mascot" @@ -60,10 +59,6 @@ func init() { gopher3 = ebiten.NewImageFromImage(img3) } -func init() { - rand.Seed(time.Now().UnixNano()) -} - type mascot struct { x16 int y16 int @@ -105,8 +100,8 @@ func (m *mascot) Update() error { } // If the mascto is on the ground, cause an action in random. - if rand.Intn(60) == 0 && m.y16 == 0 { - switch rand.Intn(2) { + if rand.IntN(60) == 0 && m.y16 == 0 { + switch rand.IntN(2) { case 0: // Jump. m.vy16 = -240 diff --git a/examples/particles/main.go b/examples/particles/main.go index b1b44b71b..081740fbf 100644 --- a/examples/particles/main.go +++ b/examples/particles/main.go @@ -23,18 +23,13 @@ import ( _ "image/png" "log" "math" - "math/rand" - "time" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/ebitenutil" "github.com/hajimehoshi/ebiten/v2/examples/resources/images" ) -func init() { - rand.Seed(time.Now().UnixNano()) -} - const ( screenWidth = 640 screenHeight = 480 @@ -110,7 +105,7 @@ func (s *sprite) draw(screen *ebiten.Image) { } func newSprite(img *ebiten.Image) *sprite { - c := rand.Intn(50) + 300 + c := rand.IntN(50) + 300 dir := rand.Float64() * 2 * math.Pi a := rand.Float64() * 2 * math.Pi s := rand.Float64()*0.1 + 0.4 @@ -136,7 +131,7 @@ func (g *Game) Update() error { g.sprites = list.New() } - if g.sprites.Len() < 500 && rand.Intn(4) < 3 { + if g.sprites.Len() < 500 && rand.IntN(4) < 3 { // Emit g.sprites.PushBack(newSprite(smokeImage)) } diff --git a/examples/set/main.go b/examples/set/main.go index bb00c50d7..1b9f8d4b8 100644 --- a/examples/set/main.go +++ b/examples/set/main.go @@ -18,8 +18,7 @@ import ( "fmt" "image/color" "log" - "math/rand" - "time" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/ebitenutil" @@ -30,10 +29,6 @@ const ( screenHeight = 240 ) -func init() { - rand.Seed(time.Now().UnixNano()) -} - type Game struct { offscreen *ebiten.Image } @@ -46,12 +41,12 @@ func NewGame() *Game { func (g *Game) Update() error { s := g.offscreen.Bounds().Size() - x := rand.Intn(s.X) - y := rand.Intn(s.Y) + x := rand.IntN(s.X) + y := rand.IntN(s.Y) c := color.RGBA{ - byte(rand.Intn(256)), - byte(rand.Intn(256)), - byte(rand.Intn(256)), + byte(rand.IntN(256)), + byte(rand.IntN(256)), + byte(rand.IntN(256)), byte(0xff), } g.offscreen.Set(x, y, c) diff --git a/examples/snake/main.go b/examples/snake/main.go index b8b600f15..34dd9989b 100644 --- a/examples/snake/main.go +++ b/examples/snake/main.go @@ -18,8 +18,7 @@ import ( "fmt" "image/color" "log" - "math/rand" - "time" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/ebitenutil" @@ -59,10 +58,6 @@ type Game struct { level int } -func init() { - rand.Seed(time.Now().UnixNano()) -} - func (g *Game) collidesWithApple() bool { return g.snakeBody[0].X == g.apple.X && g.snakeBody[0].Y == g.apple.Y @@ -130,8 +125,8 @@ func (g *Game) Update() error { } if g.collidesWithApple() { - g.apple.X = rand.Intn(xGridCountInScreen - 1) - g.apple.Y = rand.Intn(yGridCountInScreen - 1) + g.apple.X = rand.IntN(xGridCountInScreen - 1) + g.apple.Y = rand.IntN(yGridCountInScreen - 1) g.snakeBody = append(g.snakeBody, Position{ X: g.snakeBody[len(g.snakeBody)-1].X, Y: g.snakeBody[len(g.snakeBody)-1].Y, diff --git a/examples/sprites/main.go b/examples/sprites/main.go index 16afb0da6..aa4f5f510 100644 --- a/examples/sprites/main.go +++ b/examples/sprites/main.go @@ -21,7 +21,7 @@ import ( _ "image/png" "log" "math" - "math/rand" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/ebitenutil" @@ -119,9 +119,9 @@ func (g *Game) init() { g.sprites.num = 500 for i := range g.sprites.sprites { w, h := ebitenImage.Bounds().Dx(), ebitenImage.Bounds().Dy() - x, y := rand.Intn(screenWidth-w), rand.Intn(screenHeight-h) - vx, vy := 2*rand.Intn(2)-1, 2*rand.Intn(2)-1 - a := rand.Intn(maxAngle) + x, y := rand.IntN(screenWidth-w), rand.IntN(screenHeight-h) + vx, vy := 2*rand.IntN(2)-1, 2*rand.IntN(2)-1 + a := rand.IntN(maxAngle) g.sprites.sprites[i] = &Sprite{ imageWidth: w, imageHeight: h, diff --git a/examples/spriteshd/main.go b/examples/spriteshd/main.go index 4d6dd5635..6d6e8c7f0 100644 --- a/examples/spriteshd/main.go +++ b/examples/spriteshd/main.go @@ -21,7 +21,7 @@ import ( _ "image/png" "log" "math" - "math/rand" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/ebitenutil" @@ -117,9 +117,9 @@ func (g *Game) init() { g.sprites.num = 500 for i := range g.sprites.sprites { w, h := ebitenImage.Bounds().Dx(), ebitenImage.Bounds().Dy() - x, y := rand.Intn(screenWidth-w), rand.Intn(screenHeight-h) - vx, vy := 2*rand.Intn(2)-1, 2*rand.Intn(2)-1 - a := rand.Intn(maxAngle) + x, y := rand.IntN(screenWidth-w), rand.IntN(screenHeight-h) + vx, vy := 2*rand.IntN(2)-1, 2*rand.IntN(2)-1 + a := rand.IntN(maxAngle) g.sprites.sprites[i] = &Sprite{ imageWidth: w, imageHeight: h, diff --git a/examples/squiral/main.go b/examples/squiral/main.go index 3c5bc83be..5bcdf0d54 100644 --- a/examples/squiral/main.go +++ b/examples/squiral/main.go @@ -20,8 +20,7 @@ import ( "fmt" "image/color" "log" - "math/rand" - "time" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/ebitenutil" @@ -127,8 +126,8 @@ type squiral struct { func (s *squiral) spawn(game *Game) { s.dead = false - rx := rand.Intn(width-4) + 2 - ry := rand.Intn(height-4) + 2 + rx := rand.IntN(width-4) + 2 + ry := rand.IntN(height-4) + 2 for dx := -2; dx <= 2; dx++ { for dy := -2; dy <= 2; dy++ { @@ -140,15 +139,15 @@ func (s *squiral) spawn(game *Game) { } } - s.speed = rand.Intn(5) + 1 + s.speed = rand.IntN(5) + 1 s.pos.x = rx s.pos.y = ry - s.dir = rand.Intn(4) + s.dir = rand.IntN(4) game.colorCycle = (game.colorCycle + 1) % len(palettes[game.selectedPalette].colors) s.col = palettes[game.selectedPalette].colors[game.colorCycle] - s.rot = rand.Intn(2) + s.rot = rand.IntN(2) } func (s *squiral) step(game *Game) { @@ -157,7 +156,7 @@ func (s *squiral) step(game *Game) { } x, y := s.pos.x, s.pos.y // shorthands - change := rand.Intn(1000) + change := rand.IntN(1000) if change < 2 { // On 0.2% of iterations, switch rotation direction. s.rot = (s.rot + 1) % 2 @@ -267,10 +266,6 @@ func (a *automaton) step(game *Game) { } } -func init() { - rand.Seed(time.Now().UnixNano()) -} - type Game struct { selectedPalette int colorCycle int diff --git a/examples/stars/main.go b/examples/stars/main.go index 9b79921d6..1f611e37b 100644 --- a/examples/stars/main.go +++ b/examples/stars/main.go @@ -17,8 +17,7 @@ package main import ( "image/color" "log" - "math/rand" - "time" + "math/rand/v2" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/vector" @@ -97,7 +96,6 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) { } func main() { - rand.Seed(time.Now().UnixNano()) ebiten.SetWindowSize(screenWidth, screenHeight) ebiten.SetWindowTitle("Stars (Ebitengine Demo)") if err := ebiten.RunGame(NewGame()); err != nil { diff --git a/examples/windowsize/main.go b/examples/windowsize/main.go index 8722a6e7e..6e7d852e5 100644 --- a/examples/windowsize/main.go +++ b/examples/windowsize/main.go @@ -22,12 +22,11 @@ import ( _ "image/jpeg" "log" "math" - "math/rand" + "math/rand/v2" "regexp" "strconv" "strings" "sync" - "time" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/ebitenutil" @@ -55,7 +54,6 @@ var ( func init() { flag.Parse() - rand.Seed(time.Now().UnixNano()) } const ( @@ -71,9 +69,9 @@ var ( func createRandomIconImage() image.Image { const size = 32 - rf := float64(rand.Intn(0x100)) - gf := float64(rand.Intn(0x100)) - bf := float64(rand.Intn(0x100)) + rf := float64(rand.IntN(0x100)) + gf := float64(rand.IntN(0x100)) + bf := float64(rand.IntN(0x100)) img := ebiten.NewImage(size, size) pix := make([]byte, 4*size*size) for j := 0; j < size; j++ { diff --git a/image_test.go b/image_test.go index fc12afc6b..5eec9a5f2 100644 --- a/image_test.go +++ b/image_test.go @@ -22,10 +22,9 @@ import ( "image/draw" _ "image/png" "math" - "math/rand" + "math/rand/v2" "runtime" "testing" - "time" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/examples/resources/images" @@ -37,10 +36,6 @@ import ( // maxImageSize is a maximum image size that should work in almost every environment. const maxImageSize = 4096 - 2 -func init() { - rand.Seed(time.Now().UnixNano()) -} - func skipTooSlowTests(t *testing.T) bool { if testing.Short() { t.Skip("skipping test in short mode") @@ -4272,7 +4267,7 @@ func TestImageAntiAlias(t *testing.T) { ebiten.BlendXor, ebiten.BlendLighter, } { - rnd := rand.New(rand.NewSource(0)) + rnd := rand.New(rand.NewPCG(0, 0)) max := func(x, y, z byte) byte { if x >= y && x >= z { return x diff --git a/internal/affine/colorm_test.go b/internal/affine/colorm_test.go index 1f30867c2..9257f0769 100644 --- a/internal/affine/colorm_test.go +++ b/internal/affine/colorm_test.go @@ -16,7 +16,7 @@ package affine_test import ( "math" - "math/rand" + "math/rand/v2" "testing" "github.com/hajimehoshi/ebiten/v2/internal/affine"