diff --git a/badger/y/y_test.go b/badger/y/y_test.go index 168da889b..d1b963184 100644 --- a/badger/y/y_test.go +++ b/badger/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.