MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / GenerateRandomID

Function GenerateRandomID

base/util.go:128–134  ·  view source on GitHub ↗

GenerateRandomID returns a cryptographically-secure 128-bit random number encoded as a hex string.

()

Source from the content-addressed store, hash-verified

126
127// GenerateRandomID returns a cryptographically-secure 128-bit random number encoded as a hex string.
128func GenerateRandomID() (string, error) {
129 val, err := randCryptoHex(128)
130 if err != nil {
131 return "", fmt.Errorf("failed to generate random ID: %w", err)
132 }
133 return val, nil
134}
135
136// randCryptoHex returns a cryptographically-secure random number of length sizeBits encoded as a hex string.
137func randCryptoHex(sizeBits int) (string, error) {

Calls 2

randCryptoHexFunction · 0.85
ErrorfMethod · 0.80