diff --git a/y/y_test.go b/y/y_test.go index 168da889b..0680caef5 100644 --- a/y/y_test.go +++ b/y/y_test.go @@ -176,7 +176,7 @@ func TestPagebufferReader2(t *testing.T) { require.Equal(t, n, 10, "length of buffer and length written should be equal") require.NoError(t, err, "unable to write bytes to buffer") - randOffset := int(rand.Int31n(int32(b.length))) + randOffset := int(rand.Int31n(int32(b.length - 1))) randLength := int(rand.Int31n(int32(b.length - randOffset))) reader := b.NewReaderAt(randOffset) // Read randLength bytes.