MCPcopy Index your code
hub / github.com/devfile/api / GetRandomUniqueString

Function GetRandomUniqueString

test/v200/utils/common/test_utils.go:220–227  ·  view source on GitHub ↗

GetRandomUniqueString returns a unique random string which is n characters long plus an integer to ensure uniqueness If lower is set to true a lower case string is returned.

(n int, lower bool)

Source from the content-addressed store, hash-verified

218// GetRandomUniqueString returns a unique random string which is n characters long plus an integer to ensure uniqueness
219// If lower is set to true a lower case string is returned.
220func GetRandomUniqueString(n int, lower bool) string {
221 StringCount++
222 countAsString := fmt.Sprintf("%05d", StringCount)
223 if n < len(countAsString) {
224 n += len(countAsString)
225 }
226 return fmt.Sprintf("%s%s", GetRandomString(n-len(countAsString), lower), countAsString)
227}
228
229const schemaBytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
230

Callers 15

CreateEndpointsMethod · 0.85
createExecCommandMethod · 0.85
createApplyCommandMethod · 0.85
AddParentComponentMethod · 0.85
CreateParentEndpointsMethod · 0.85
createParentProjectMethod · 0.85

Calls 1

GetRandomStringFunction · 0.85

Tested by

no test coverage detected