/// Generate permutations for a given name and pool size.
///
/// ```
/// use rusty_rail::consistenthash::permute_backend;
///
/// assert_eq!(permute_backend("fred", 7), vec![1, 0, 6, 5, 4, 3, 2]);
/// assert_eq!(permute_backend("ralph", 7), vec![3, 2, 1, 0, 6, 5, 4]);
/// assert_eq!(permute_backend("larry", 7), vec![4, 0, 3, 6, 2, 5, 1]);
/// ```
Generate permutations for a given name and pool size.


Generate permutations for a given name and pool size .
pub fn permute_backend(name: &str, pool_size: u32) -> Vec<u32> {
    // May be faster to generate just-in-time as an iterator: profile eventually.
    let mut s = SipHasher::new();
    name.hash(&mut s);
    let offset = (s.finish() % pool_size as u64) as u32;
    "differenthash".hash(&mut s);
    let skip = (s.finish() % (pool_size as u64 - 1) + 1) as u32;
    permutations(offset, skip, pool_size)
}
pub fn permute_backend ( name : & str , pool_size : u32 ) -> Vec < u32 > { // May be faster to generate just-in-time as an iterator: profile eventually. let mut s = SipHasher :: new ( ) ; name . hash ( & mut s ) ; let offset = ( s . finish ( ) % pool_size as u64 ) as u32 ; " " . hash ( & mut s ) ; let skip = ( s . finish ( ) % ( pool_size as u64 - 1 ) + 1 ) as u32 ; permutations ( offset , skip , pool_size ) }
Generate permutations for a given name and pool size.
Generate permutations for a given name and pool size .
name
&str
pool_size
u32