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>
This commit is contained in:
parent
00b53d39c3
commit
5731b5256b
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user