Use rand.Seed to seed the random function generator (#6)

* Blacklist some sytest tests that are failing in our environment

* Commenting out test that isn't reliably passing or failing, probably a race

* refresh latest dendrite main

* use rand.Seed to seed the random function

Co-authored-by: Brian Meek <brian@hntlabs.com>
Co-authored-by: Tak Wai Wong <takwaiw@gmail.com>
This commit is contained in:
Tak Wai Wong 2022-06-09 16:25:12 -04:00 committed by GitHub
parent a37b64c9f1
commit f510b6c718
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@ package config
import ( import (
"math/rand" "math/rand"
"time"
"github.com/matrix-org/dendrite/clientapi/auth/authtypes" "github.com/matrix-org/dendrite/clientapi/auth/authtypes"
) )
@ -72,6 +73,7 @@ const lettersAndNumbers = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0
func newNonce(n int) string { func newNonce(n int) string {
nonce := make([]byte, n) nonce := make([]byte, n)
rand.Seed(time.Now().UnixNano())
for i := range nonce { for i := range nonce {
nonce[i] = lettersAndNumbers[rand.Int63()%int64(len(lettersAndNumbers))] nonce[i] = lettersAndNumbers[rand.Int63()%int64(len(lettersAndNumbers))]