From 4e04f853dcf8ea3dc342efc9a5efce814ec655d0 Mon Sep 17 00:00:00 2001 From: Zykatious <30608121+Zykatious@users.noreply.github.com> Date: Fri, 24 Nov 2017 11:24:36 +0000 Subject: [PATCH] Updated Random Seed Removed unnecessary seed generation inside cell creation loop. --- examples/games/life/life.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/games/life/life.go b/examples/games/life/life.go index 192792c..6941342 100644 --- a/examples/games/life/life.go +++ b/examples/games/life/life.go @@ -55,13 +55,14 @@ func (g *Game) Init() { for i := int32(0); i <= g.ScreenWidth/squareSize; i++ { g.Cells[i] = make([]*Cell, g.ScreenHeight/squareSize+1) } + + rand.Seed(time.Now().UnixNano()) for x := int32(0); x <= g.ScreenWidth/squareSize; x++ { for y := int32(0); y <= g.ScreenHeight/squareSize; y++ { g.Cells[x][y] = &Cell{} g.Cells[x][y].Position = raylib.NewVector2((float32(x) * squareSize), (float32(y)*squareSize)+1) g.Cells[x][y].Size = raylib.NewVector2(squareSize-1, squareSize-1) - rand.Seed(time.Now().UnixNano()) if rand.Float64() < 0.1 { g.Cells[x][y].Alive = true }