MCPcopy
hub / github.com/dgraph-io/dgraph / GetRandomName

Function GetRandomName

x/names-generator.go:1281–1294  ·  view source on GitHub ↗

GetRandomName generates a random name from the list of adjectives and surnames in this package formatted as "adjective_surname". For example 'focused_turing'. If retry is non-zero, a random integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3`

(retry int)

Source from the content-addressed store, hash-verified

1279// formatted as "adjective_surname". For example 'focused_turing'. If retry is non-zero, a random
1280// integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3`
1281func GetRandomName(retry int) string {
1282begin:
1283 //nolint:gosec // cryptographic precision not required for randomly selecting from set
1284 name := fmt.Sprintf("%s_%s", left[rand.Intn(len(left))], right[rand.Intn(len(right))])
1285 if name == "boring_wozniak" /* Steve Wozniak is not boring */ {
1286 goto begin
1287 }
1288
1289 if retry > 0 {
1290 //nolint:gosec // cryptographic precision not required for randomly selecting from fixed range
1291 name = fmt.Sprintf("%s%d", name, rand.Intn(10))
1292 }
1293 return name
1294}

Callers 1

ProcessBackupRequestFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected