From a43117c270e336d21c7c91ad30914e1b71567c08 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Fri, 19 Aug 2022 12:01:07 +0200 Subject: [PATCH] Added number generation to each function --- Dice/Dice.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dice/Dice.go b/Dice/Dice.go index 7451d05..a2d010f 100644 --- a/Dice/Dice.go +++ b/Dice/Dice.go @@ -13,8 +13,12 @@ var ( surfaces, diceThrows, modidier int ) -func Cast(surfaces, diceThrows, modifier int) { +func genSeed() { rand.Seed(time.Now().Unix()) +} + +func Cast(surfaces, diceThrows, modifier int) { + genSeed() var ( casts []int cast, total int @@ -48,6 +52,7 @@ func Cast(surfaces, diceThrows, modifier int) { } func SimpleCast(modifier int) int { + genSeed() var cast = rand.Intn(20) + 1