Compute the index of the given position.
Pick a position within the given range, described by an offset and width, returning the index of the picked element.
Pick a position within the given range, described by an offset and width, returning the index of the picked element.
The Rng used for picking.
The offset from which to pick.
The width of the range.
Pick two elements.
Pick two elements. They are picked without replacement as long as the offset and width admits it. Zero-width nodes cannot be picked without replacement.
The Rng used for picking.
The offset from which to pick.
The width of the range.
Class
Ring
implements a hash ring. Given an array mapping indices to positions, the ring supplies the reverse mapping: to which index does a position belong?Its distinguishing feature is that
Ring
can pick random positions in a range. (And then map them to their corresponding indices.) Ring can also pick without replacement two elements from a range.