From c3f2c20e4e205a7fc531b397cf0c510c6db836b7 Mon Sep 17 00:00:00 2001 From: joeyak Date: Sun, 14 Apr 2019 21:02:44 -0400 Subject: [PATCH] Add rand seed so the colors aren't the same --- common/colors.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/colors.go b/common/colors.go index 58e3a6f..5b2312e 100644 --- a/common/colors.go +++ b/common/colors.go @@ -7,8 +7,13 @@ import ( "regexp" "strconv" "strings" + "time" ) +func init() { + rand.Seed(int64(time.Now().Nanosecond())) +} + // Colors holds all the valid html color names for MovieNight // the values in colors must be lowercase so it matches with the color input // this saves from having to call strings.ToLower(color) every time to check @@ -61,8 +66,6 @@ func IsValidColor(s string) bool { return false } total := float32(r + g + b) - fmt.Println(total) - fmt.Println(float32(b) / total) return total > 0.7 && float32(b)/total < 0.7 } return false