MCPcopy Create free account
hub / github.com/coze-dev/coze-go / generateRandomString

Function generateRandomString

utils.go:28–34  ·  view source on GitHub ↗
(length int)

Source from the content-addressed store, hash-verified

26}
27
28func generateRandomString(length int) (string, error) {
29 bytes := make([]byte, length/2)
30 if _, err := rand.Read(bytes); err != nil {
31 return "", err
32 }
33 return bytesToHex(bytes), nil
34}
35
36func bytesToHex(bytes []byte) string {
37 hex := make([]byte, len(bytes)*2)

Callers 3

GetOAuthURLMethod · 0.85
GenerateJWTMethod · 0.85

Calls 1

bytesToHexFunction · 0.85

Tested by 1