Selaa lähdekoodia

archive/zip, crypto/tls: use rand.Read instead of casting ints to bytes

Makes tests run ~1ms faster.

Change-Id: Ida509952469540280996d2bd9266724829e53c91
Reviewed-on: https://go-review.googlesource.com/47359
Reviewed-by: Filippo Valsorda <hi@filippo.io>
Run-TryBot: Filippo Valsorda <hi@filippo.io>
TryBot-Result: Gobot Gobot <gobot@golang.org>
tls13
Carl Mastrangelo 7 vuotta sitten
committed by Filippo Valsorda
vanhempi
commit
5731b5256b
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. +2
    -2
      handshake_messages_test.go

+ 2
- 2
handshake_messages_test.go Näytä tiedosto

@@ -98,8 +98,8 @@ func TestFuzz(t *testing.T) {

func randomBytes(n int, rand *rand.Rand) []byte {
r := make([]byte, n)
for i := 0; i < n; i++ {
r[i] = byte(rand.Int31())
if _, err := rand.Read(r); err != nil {
panic("rand.Read failed: " + err.Error())
}
return r
}


Ladataan…
Peruuta
Tallenna