Fix seeding for generating random zones

This commit is contained in:
srikiz 2022-03-15 00:19:48 +05:30
parent aff109f9fc
commit 28a5d7e53a
1 changed files with 3 additions and 1 deletions

View File

@ -19,6 +19,7 @@ package do
import (
"errors"
"math/rand"
"time"
)
var allZones = []string{
@ -46,7 +47,8 @@ func RandomZones(count int) ([]string, error) {
return nil, ErrMoreThanOneZone
}
n := rand.Int() % len(allZones)
rand.Seed(time.Now().UnixNano())
n := rand.Intn(1000) % len(allZones)
chosenZone := allZones[n]
chosenZones := make([]string, 0)