Skip to content

Commit f5e7374

Browse files
committed
store: GenerateName: use 3 words
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent be612e4 commit f5e7374

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

store/random_names.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,37 @@ var nouns = []string{
249249
"yard",
250250
"zone",
251251
}
252+
253+
var themes = []string{
254+
"balance",
255+
"bliss",
256+
"breeze",
257+
"calm",
258+
"cascade",
259+
"cheer",
260+
"dream",
261+
"drift",
262+
"echo",
263+
"flow",
264+
"flutter",
265+
"gleam",
266+
"glimmer",
267+
"glow",
268+
"harmony",
269+
"hope",
270+
"hum",
271+
"joy",
272+
"journey",
273+
"lightness",
274+
"melody",
275+
"mirth",
276+
"peace",
277+
"radiance",
278+
"rhythm",
279+
"ripple",
280+
"serenity",
281+
"shine",
282+
"sparkle",
283+
"vibe",
284+
"whisper",
285+
}

store/util.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package store
22

33
import (
4-
"fmt"
54
"math/rand/v2"
65
"os"
76
"regexp"
@@ -40,11 +39,11 @@ func ValidateName(s string) (string, error) {
4039

4140
func GenerateName(txn *Txn) (string, error) {
4241
var name string
43-
for i := range 6 {
44-
name = adjectives[rand.IntN(len(adjectives))] + "_" + nouns[rand.IntN(len(nouns))] // #nosec G404 -- ignore "Use of weak random number generator"
45-
if i > 0 {
46-
name += fmt.Sprint(rand.IntN(10)) // #nosec G404 -- ignore "Use of weak random number generator"
47-
}
42+
for range 6 {
43+
name = adjectives[rand.IntN(len(adjectives))] + "_" +
44+
nouns[rand.IntN(len(nouns))] + "_" +
45+
themes[rand.IntN(len(themes))] // #nosec G404 -- ignore "Use of weak random number generator"
46+
4847
if _, err := txn.NodeGroupByName(name); err != nil {
4948
if !os.IsNotExist(errors.Cause(err)) {
5049
return "", err

0 commit comments

Comments
 (0)