func random(t testing.TB, length int) []byte { rd := restic.NewRandReader(rand.New(rand.NewSource(int64(length)))) buf := make([]byte, length) _, err := io.ReadFull(rd, buf) if err != nil { t.Fatalf("unable to read %d random bytes: %v", length, err) } return buf }
// fakeFile returns a reader which yields deterministic pseudo-random data. func fakeFile(t testing.TB, seed, size int64) io.Reader { return io.LimitReader(restic.NewRandReader(rand.New(rand.NewSource(seed))), size) }