Skip to content

Commit 78aba8e

Browse files
committed
fixed shuffle call to obey array boundaries
shuffle accesses array at index n+1, so the passed n should be i-2 like a few lines above
1 parent db5a4d1 commit 78aba8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/shuffle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ int shuffle_by_chunks() {
164164
if(feof(fin)) break;
165165
i++;
166166
}
167-
shuffle(array, i-1); //Last chunk may be smaller than array_size
167+
shuffle(array, i-2); //Last chunk may be smaller than array_size
168168
write_chunk(array,i,fid);
169169
l += i;
170170
if(verbose > 1) fprintf(stderr, "\033[22Gprocessed %ld lines.\n", l);

0 commit comments

Comments
 (0)