From 75cba09617053cfed68be7cdae109548be4ccd15 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sat, 31 Jul 2021 13:34:43 -0500 Subject: [PATCH] Make hat size random --- cmd/client/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/client/main.go b/cmd/client/main.go index b9aef0a..cf0430d 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -3,12 +3,15 @@ package main import ( "context" "fmt" + "math/rand" "net/http" "os" "haberdasher-twirp/haberdasher" ) +const MaxSize = 12 + func main() { var host string = "http://localhost:8080" if len(os.Args) > 1 { @@ -17,7 +20,7 @@ func main() { client := haberdasher.NewHaberdasherProtobufClient(host, &http.Client{}) - hat, err := client.MakeHat(context.Background(), &haberdasher.Size{Inches: 12}) + hat, err := client.MakeHat(context.Background(), &haberdasher.Size{Inches: int32(rand.Intn(MaxSize))}) if err != nil { fmt.Printf("oh no: %v\n", err) os.Exit(1)