NameDigitWith returns a random name with a two-digit suffix (00-99), in the format "[adjective][delim][surname][digit]" e.g. "happy_smith42". Provides some collision resistance while keeping names short and clean. Not guaranteed to be unique.
(delim string)
| 40 | // Provides some collision resistance while keeping names short and clean. |
| 41 | // Not guaranteed to be unique. |
| 42 | func NameDigitWith(delim string) string { |
| 43 | //nolint:gosec // The random digit doesn't need to be cryptographically secure. |
| 44 | name := NameWith(delim) + fmt.Sprintf("%02d", rand.IntN(100)) |
| 45 | return truncate(name, maxNameLen) |
| 46 | } |
| 47 | |
| 48 | // UniqueName returns a random name with a monotonically increasing suffix, |
| 49 | // guaranteeing uniqueness within the process. The name is truncated to 32 |