package util import ( "math/rand" "time" ) func init() { rand.Seed(time.Now().UnixNano()) } const ( chartIDSize = 12 ) // GenerateUniqueID generate the unique ID for each chart. func GenerateUniqueID() string { var b [chartIDSize]byte for i := range b { b[i] = randByte() } return string(b[:]) } func randByte() byte { c := 65 // A if rand.Intn(10) > 5 { c = 97 // a } return byte(c + rand.Intn(26)) }