MCPcopy
hub / github.com/eyebluecn/tank / RandomString4

Function RandomString4

code/tool/util/util_string.go:57–70  ·  view source on GitHub ↗

get random 4 string

()

Source from the content-addressed store, hash-verified

55
56//get random 4 string
57func RandomString4() string {
58
59 //0 and o, 1 and l are not easy to distinguish
60 var letterRunes = []rune("abcdefghijkmnpqrstuvwxyz23456789")
61
62 r := rand.New(rand.NewSource(time.Now().UnixNano()))
63
64 b := make([]rune, 4)
65 for i := range b {
66 b[i] = letterRunes[r.Intn(len(letterRunes))]
67 }
68
69 return string(b)
70}

Callers 1

CreateMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected