Signed-off-by: Alexander Morozov <lk4d4@docker.com>
| ... | ... |
@@ -2,7 +2,6 @@ package namesgenerator |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 |
- "math/rand" |
|
| 6 | 5 |
|
| 7 | 6 |
"github.com/docker/docker/pkg/random" |
| 8 | 7 |
) |
| ... | ... |
@@ -354,14 +353,13 @@ var ( |
| 354 | 354 |
// Ada Yonath - an Israeli crystallographer, the first woman from the Middle East to win a Nobel prize in the sciences. https://en.wikipedia.org/wiki/Ada_Yonath |
| 355 | 355 |
"yonath", |
| 356 | 356 |
} |
| 357 |
- |
|
| 358 |
- rnd = rand.New(random.NewSource()) |
|
| 359 | 357 |
) |
| 360 | 358 |
|
| 361 | 359 |
// GetRandomName generates a random name from the list of adjectives and surnames in this package |
| 362 | 360 |
// formatted as "adjective_surname". For example 'focused_turing'. If retry is non-zero, a random |
| 363 | 361 |
// integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3` |
| 364 | 362 |
func GetRandomName(retry int) string {
|
| 363 |
+ rnd := random.Rand |
|
| 365 | 364 |
begin: |
| 366 | 365 |
name := fmt.Sprintf("%s_%s", left[rnd.Intn(len(left))], right[rnd.Intn(len(right))])
|
| 367 | 366 |
if name == "boring_wozniak" /* Steve Wozniak is not boring */ {
|
| ... | ... |
@@ -14,9 +14,8 @@ func GenerateRandomAlphaOnlyString(n int) string {
|
| 14 | 14 |
// make a really long string |
| 15 | 15 |
letters := []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
| 16 | 16 |
b := make([]byte, n) |
| 17 |
- r := rand.New(random.NewSource()) |
|
| 18 | 17 |
for i := range b {
|
| 19 |
- b[i] = letters[r.Intn(len(letters))] |
|
| 18 |
+ b[i] = letters[random.Rand.Intn(len(letters))] |
|
| 20 | 19 |
} |
| 21 | 20 |
return string(b) |
| 22 | 21 |
} |