Refactor _randomIDInBucketRange.