package main import ( "flag" "fmt" "math/rand" "time" ) func main() { var surfaces, throws int rand.Seed(time.Now().Unix()) // fmt.Println("Half arsed version without error checking.") // fmt.Println("Please insert number of die surfaces followed by amount of dice thrown.") // fmt.Scanf("%d %d", &surfaces, &throws) flag.IntVar(&surfaces, "s", 20, "Specify die type") flag.IntVar(&throws, "t", 1, "Specify dice throws") flag.Parse() fmt.Println(surfaces) fmt.Println(throws) fmt.Println(Cast(surfaces, throws)) } func Cast(dieSurfaces, castAmount int) int { fmt.Println(dieSurfaces) fmt.Println(castAmount) var ( casts []int cast, total int ) for i := 0; i < castAmount; i++ { cast = rand.Intn(dieSurfaces) + 1 casts = append(casts, cast) total += cast } fmt.Println(casts) return total }