Function jump_consistent_hash::hash [] [src]

pub fn hash(key: u64, buckets: usize) -> u32

Takes a 64 bit key and the number of buckets, outputs a bucket number 0..buckets.

Examples

extern crate jump_consistent_hash as jch;
assert_eq!(jch::hash(0, 60), 0);
assert_eq!(jch::hash(1, 60), 55);
assert_eq!(jch::hash(2, 60), 46);