MCPcopy Index your code
hub / github.com/cubefs/cubefs / RandomString

Function RandomString

util/string.go:60–69  ·  view source on GitHub ↗
(length int, seed RandomSeed)

Source from the content-addressed store, hash-verified

58)
59
60func RandomString(length int, seed RandomSeed) string {
61 runs := seed.Runes()
62 result := ""
63 for i := 0; i < length; i++ {
64 lenInt64 := int64(len(runs))
65 randNumber, _ := rand.Int(rand.Reader, big.NewInt(lenInt64))
66 result += string(runs[randNumber.Uint64()])
67 }
68 return result
69}
70
71// Any2String format any value to string.
72func Any2String(value interface{}) string {

Callers 13

TestExtend_BytesFunction · 0.92
TestMUPart_BytesFunction · 0.92
TestMUParts_BytesFunction · 0.92
TestMUParts_ModifyFunction · 0.92
TestMUSession_BytesFunction · 0.92
ActionToUniqueRouteNameFunction · 0.92
tempFileNameFunction · 0.92
CreateNewKeyMethod · 0.92
refreshOSSSecureMethod · 0.92
createKeyMethod · 0.92

Calls 3

RunesMethod · 0.80
IntMethod · 0.80
Uint64Method · 0.45

Tested by 7

TestExtend_BytesFunction · 0.74
TestMUPart_BytesFunction · 0.74
TestMUParts_BytesFunction · 0.74
TestMUParts_ModifyFunction · 0.74
TestMUSession_BytesFunction · 0.74
TestRandomStringFunction · 0.74