mirror of https://github.com/restic/restic.git
Use RandReader instead of rand directly
This is a fix to be backwards-compatible with Go < 1.6.
This commit is contained in:
parent
14db71d3fa
commit
952f124238
|
@ -13,9 +13,9 @@ func randomSize(min, max int) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func random(t *testing.T, length int) []byte {
|
func random(t *testing.T, length int) []byte {
|
||||||
src := rand.New(rand.NewSource(int64(length)))
|
rd := NewRandReader(rand.New(rand.NewSource(int64(length))))
|
||||||
buf := make([]byte, length)
|
buf := make([]byte, length)
|
||||||
_, err := io.ReadFull(src, buf)
|
_, err := io.ReadFull(rd, buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to read %d random bytes: %v", length, err)
|
t.Fatalf("unable to read %d random bytes: %v", length, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue