diff --git a/testing/random.go b/testing/random.go index 1795138b..560cc8dd 100644 --- a/testing/random.go +++ b/testing/random.go @@ -5,17 +5,17 @@ import ( "time" ) -func init() { - rand.Seed(time.Now().UnixNano()) -} - const letterBytes = "abcdefghijklmnopqrstuvwxyz" +var ( + random = rand.New(rand.NewSource(time.Now().UnixNano())) +) + // Copied from https://stackoverflow.com/a/31832326 with thanks func RandStringBytesRmndr(n int) string { b := make([]byte, n) for i := range b { - b[i] = letterBytes[rand.Int63()%int64(len(letterBytes))] + b[i] = letterBytes[random.Int63()%int64(len(letterBytes))] } return string(b) }