internal/namesgenerator: rewrite with math/rand/v2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2026-07-14 10:49:16 +02:00
parent 6044398f34
commit eef35834c3

View File

@@ -12,7 +12,7 @@
package namesgenerator
import (
"math/rand"
"math/rand/v2"
"strconv"
)
@@ -848,13 +848,13 @@ var (
// integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3`
func GetRandomName(retry int) string {
begin:
name := left[rand.Intn(len(left))] + "_" + right[rand.Intn(len(right))] //nolint:gosec // G404: Use of weak random number generator (math/rand instead of crypto/rand)
name := left[rand.IntN(len(left))] + "_" + right[rand.IntN(len(right))] // #nosec G404 -- Use of weak random number generator (math/rand instead of crypto/rand)
if name == "boring_wozniak" /* Steve Wozniak is not boring */ {
goto begin
}
if retry > 0 {
name += strconv.Itoa(rand.Intn(10)) //nolint:gosec // G404: Use of weak random number generator (math/rand instead of crypto/rand)
name += strconv.Itoa(rand.IntN(10)) // #nosec G404 -- Use of weak random number generator (math/rand instead of crypto/rand)
}
return name
}