Moved rng back to main

This commit is contained in:
Nox Sluijtman 2022-08-19 12:04:04 +02:00
parent a43117c270
commit bed2f3df01
3 changed files with 3 additions and 9 deletions

View file

@ -4,13 +4,11 @@ import (
"fmt" "fmt"
"math/rand" "math/rand"
"strings" "strings"
"time"
"gitlab.com/EternalWanderer/dice-roller/Colors" "gitlab.com/EternalWanderer/dice-roller/Colors"
) )
func Toss(castAmount int) { func Toss(castAmount int) {
rand.Seed(time.Now().Unix())
var ( var (
coins []string coins []string
coin string coin string

View file

@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"math/rand" "math/rand"
"strings" "strings"
"time"
"gitlab.com/EternalWanderer/dice-roller/Colors" "gitlab.com/EternalWanderer/dice-roller/Colors"
) )
@ -13,12 +12,7 @@ var (
surfaces, diceThrows, modidier int surfaces, diceThrows, modidier int
) )
func genSeed() {
rand.Seed(time.Now().Unix())
}
func Cast(surfaces, diceThrows, modifier int) { func Cast(surfaces, diceThrows, modifier int) {
genSeed()
var ( var (
casts []int casts []int
cast, total int cast, total int
@ -52,7 +46,6 @@ func Cast(surfaces, diceThrows, modifier int) {
} }
func SimpleCast(modifier int) int { func SimpleCast(modifier int) int {
genSeed()
var cast = rand.Intn(20) + 1 var cast = rand.Intn(20) + 1

View file

@ -3,7 +3,9 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"math/rand"
"os" "os"
"time"
"gitlab.com/EternalWanderer/dice-roller/Coin" "gitlab.com/EternalWanderer/dice-roller/Coin"
"gitlab.com/EternalWanderer/dice-roller/Colors" "gitlab.com/EternalWanderer/dice-roller/Colors"
@ -17,6 +19,7 @@ var (
func main() { func main() {
ParseFlags() ParseFlags()
rand.Seed(time.Now().Unix())
switch { switch {