MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / randomString

Function randomString

src/internal/authentication/authentication.go:497–506  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

495}
496
497func randomString(n int) string {
498 const alphanum = "-AbCdEfGhIjKlMnOpQrStUvWxYz0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ_"
499
500 var bytes = make([]byte, n)
501 rand.Read(bytes)
502 for i, b := range bytes {
503 bytes[i] = alphanum[b%byte(len(alphanum))]
504 }
505 return string(bytes)
506}
507
508func randomID(n int) string {
509 const alphanum = "ABCDEFGHJKLMNOPQRSTUVWXYZ0123456789"

Callers 2

defaultsForNewUserFunction · 0.70
setTokenFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected