mirror of
https://github.com/moby/moby.git
synced 2026-08-09 17:39:58 +00:00
internal/namesgenerator: rewrite with math/rand/v2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user