MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / String

Function String

pkg/utils/random/random.go:16–27  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

14const letterBytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
15
16func String(n int) string {
17 b := make([]byte, n)
18 letterLen := big.NewInt(int64(len(letterBytes)))
19 for i := range b {
20 idx, err := rand.Int(rand.Reader, letterLen)
21 if err != nil {
22 panic(err)
23 }
24 b[i] = letterBytes[idx.Int64()]
25 }
26 return string(b)
27}
28
29func Token() string {
30 return "openlist-" + uuid.NewString() + String(64)

Callers 14

PutMethod · 0.92
requestMethod · 0.92
requestRouteMethod · 0.92
personalRequestMethod · 0.92
genObjMethod · 0.92
DefaultConfigFunction · 0.92
SetPasswordMethod · 0.92
initUserFunction · 0.92
CreateSharingFunction · 0.92
admin.goFile · 0.92
generateStateFunction · 0.92
autoRegisterFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected