anchor.diff:                      end, 
                       {[], FCount, 0}, FCells),
       Insert = length(DB),
  -    DBSize = KeysL * ?ReplicationFactor,
  +    DBSize = KeyCount * ?ReplicationFactor,
       {DB, {DBSize, Insert, DBSize - Insert, Out}};
  -gen_kvv(uniform, Keys, Params) ->
  -    FType = proplists:get_value(ftype, Params, update),
  -    FProb = proplists:get_value(fprob, Params, 50),
  -    FDest = proplists:get_value(fdest, Params, all),
  -    KeyL = length(Keys),
  -    FRate = case FProb of 
  -                0 -> KeyL + 1;
  -                _ -> erlang:round(100 / FProb)
  -            end,
  -    {DB, O, _} = 
  +p_gen_kvv(uniform, Keys, KeyCount, FType, FDest, FCount) ->
  +    FRate = util:floor(KeyCount / FCount),
  +    {DB, O, _, _} = 
           lists:foldl(
  -          fun(Key, {AccDb, Out, Count}) ->
  -                  {RList, AddOut} = case Count rem FRate of
  -                                        0 -> get_failure_rep_group(Key, FType, FDest);
  -                                        _ -> {get_rep_group(Key), 0}
  -                                    end,
  -                  {lists:append(RList, AccDb), Out + AddOut, Count + 1}
  +          fun(Key, {AccDb, Out, Count, FCRest}) ->
  +                  {{RList, AddOut}, FCNew} = case Count rem FRate of
  +                                                 0 when FCRest > 0 -> 
  +                                                     {get_failure_rep_group(Key, FType, FDest), FCRest - 1};
  +                                                 _ -> {{get_rep_group(Key), 0}, FCRest}
  +                                             end,
  +                  {lists:append(RList, AccDb), Out + AddOut, Count + 1, FCNew}
             end, 
  -          {[], 0, 1}, Keys),
  +          {[], 0, 1, FCount}, Keys),
       Insert = length(DB),
  -    DBSize = KeyL * ?ReplicationFactor,    
  +    DBSize = KeyCount * ?ReplicationFactor,    
       {DB, {DBSize, Insert, DBSize - Insert, O}}.
   
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
positive.code: 
  -spec build_failure_cells([float()], [?RT:key()], non_neg_integer(), Acc::Res) -> Result::Res
      when is_subtype(Res, [{float(), [?RT:key()]}]).
  build_failure_cells([], [], Next, Acc) ->
      Acc;
  build_failure_cells([], T, Next, [{P, Cell} | Acc]) ->
      [{P, lists:append(T, Cell)} | Acc];
  build_failure_cells(P, [], Next, Acc) ->
      Acc;
  build_failure_cells([P | T], List, Next, Acc) ->
      Cell = lists:sublist(List, Next),
  
negative.code:     Insert = length(GoodDB) + length(BadDB),
      DBSize = KeyCount * ?ReplicationFactor,
      {lists:append(GoodDB, BadDB), {DBSize, Insert, DBSize - Insert, O}};
  p_gen_kvv({non_uniform, Fun}, Keys, KeyCount, FType, FDest, FCount) ->
      FProbList = get_non_uniform_probs(Fun, []),
      NextCell = case length(FProbList) of
                     0 -> KeyCount + 1;
                     FProbL -> erlang:round(KeyCount / FProbL)
                 end,
      FCells = lists:reverse(lists:keysort(1, build_failure_cells(FProbList, Keys, NextCell, []))),
      {DB, _, Out} = 
  