This is the jump hash implementation as discussed in https://github.com/graphite-project/carbon/issues/485