package Coin import ( "fmt" "math/rand" "strings" "time" "gitlab.com/EternalWanderer/dice-roller/Colors" ) func Toss(castAmount int) { rand.Seed(time.Now().Unix()) var ( coins []string coin string coinState int ) for i := 0; i < castAmount; i++ { coinState = rand.Intn(2) if coinState == 0 { coin = Colors.ColorYellow + "heads" + Colors.ColorReset } else { coin = Colors.ColorBlue + "tails" + Colors.ColorReset } coins = append(coins, coin) } if castAmount > 1 { fmt.Printf("%sTossing %d coins...%s\n", Colors.ColorYellow, castAmount, Colors.ColorReset) } else { fmt.Printf("%sTossing coin...%s\n", Colors.ColorYellow, Colors.ColorReset) } fmt.Printf("\t%s\n", strings.Trim(fmt.Sprint(coins), "[]")) }