MCPcopy Create free account
hub / github.com/53AI/53AIHub / GenerateRandomCode

Function GenerateRandomCode

api/common/email.go:168–177  ·  view source on GitHub ↗
(length int)

Source from the content-addressed store, hash-verified

166}
167
168func GenerateRandomCode(length int) (string, error) {
169 bytes := make([]byte, length)
170 if _, err := rand.Read(bytes); err != nil {
171 return "", err
172 }
173 for i := 0; i < length; i++ {
174 bytes[i] = byte(48 + int(bytes[i])%10) // 0-9
175 }
176 return string(bytes), nil
177}

Callers

nothing calls this directly

Calls 2

intFunction · 0.85
ReadMethod · 0.65

Tested by

no test coverage detected