Add rand seed so the colors aren't the same

This commit is contained in:
joeyak 2019-04-14 21:02:44 -04:00
parent 15a691a1b7
commit c3f2c20e4e
1 changed files with 5 additions and 2 deletions

View File

@ -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