Ref T12444. A few issues:
- x % (y - z) doesn't generate values in the full range: the largest value is never generated. Instead, use x % (1 + y - z).
- digestToRange(1, count) never generates 0. After fixing the first bug, it could generate count. The range of the arrays is 0..(count-1), inclusive. Generate the correct range instead.
- unpack('L', ...) can unpack a negative number on a 32-bit system. Use & 0x7FFFFFFF to mask off the sign bit so the result is always a positive integer.
- FileFinder might return arbitrary keys, but we rely on sequential keys (0, 1, 2, ...)