anchor.diff:  %% TYPES
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   -ifdef(with_export_type_support).
  --export_type([distribution/0, db_type/0, db_parameter/0, db_status/0, failure_type/0]).
  +-export_type([distribution/0, db_distribution/0,
  +              db_type/0, db_parameter/0, db_status/0, failure_type/0]).
   -endif.
   
   -type distribution()    :: random |
  
positive.code: 
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  % @doc This will generate a list of [ItemCount] keys with requested distribution 
  %      in the given interval.
  -spec get_db(intervals:continuous_interval(), non_neg_integer(), db_distribution()) -> [result()].
  get_db(I, Count, Distribution) ->
      get_db(I, Count, Distribution, []).
  
negative.code:     OutputType = proplists:get_value(output, Options, list_key),
      case Distribution of
          uniform -> uniform_key_list([{Interval, ItemCount}], [], OutputType);
          {non_uniform, Fun} -> non_uniform_key_list(Interval, ItemCount, Fun, [], OutputType)
      end.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  -spec uniform_key_list
          ([{Interval::intervals:continuous_interval(), ToAdd::non_neg_integer()}],
           Acc::[result_k()], OutputType::list_key) -> [result_k()];
          ([{Interval::intervals:continuous_interval(), ToAdd::non_neg_integer()}],
           Acc::[result_kv()], OutputType::list_key_val) -> [result_kv()].
  uniform_key_list([], Acc, _) -> Acc;
  uniform_key_list([{I, Add} | R] = Cmd, Acc, AccType) ->
      if Add > 100 ->
             case intervals:split(I, 2) of
                 [I1, I2] ->
                     AddD2 = Add div 2,
                     uniform_key_list([{I1, AddD2}, {I2, AddD2 + (Add rem 2)} | R],
                                      Acc, AccType);
                 [I] ->
                     uniform_key_list_no_split(Cmd, Acc, AccType)
             end;
         true ->
             uniform_key_list_no_split(Cmd, Acc, AccType)
      end.
  
  -spec uniform_key_list_no_split
          ([{Interval::intervals:continuous_interval(), ToAdd::non_neg_integer()}],
           Acc::[result_k()], OutputType::list_key) -> [result_k()];
          ([{Interval::intervals:continuous_interval(), ToAdd::non_neg_integer()}],
           Acc::[result_kv()], OutputType::list_key_val) -> [result_kv()].
  uniform_key_list_no_split([{_I, 0} | R], Acc, AccType) ->
      uniform_key_list(R, Acc, AccType);
  uniform_key_list_no_split([{I, Add} | R], Acc, AccType) ->
      {LBr, IL, IR, RBr} = intervals:get_bounds(I),
      Denom = Add + ?IIF(RBr =:= ')', 1, 0),
      ToAddKeys = lists:usort(
                    util:for_to_ex(
                      ?IIF(LBr =:= '(', 1, 0),
                      Add + ?IIF(LBr =:= '(', 0, -1),
                      fun(Index) ->
                              ?RT:get_split_key(IL, IR, {Index, Denom})
                      end)),
      ToAdd =
          case AccType of
              list_key ->
                  [Key || Key <- ToAddKeys, intervals:in(Key, I)];
              list_key_val ->
                  [{Key, gen_value()} || Key <- ToAddKeys, intervals:in(Key, I)]
          end,
      uniform_key_list(R, lists:append(ToAdd, Acc), AccType).
  
  gen_value() ->
      tester_value_creator:create_value(integer, 0, tester_parse_state:new_parse_state()).
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  -spec non_uniform_key_list
          (Interval::intervals:continuous_interval(), ToAdd::non_neg_integer(),
           Fun::random_bias:distribution_fun(), Acc::[result_k()],
           OutputType::list_key) -> [result_k()];
          (Interval::intervals:continuous_interval(), ToAdd::non_neg_integer(),
           Fun::random_bias:distribution_fun(), Acc::[result_kv()],
           OutputType::list_key_val) -> [result_kv()].
  non_uniform_key_list(_I, 0, _Fun, Acc, _AccType) -> Acc;
  non_uniform_key_list(I, ToAdd, Fun, Acc, AccType) ->
      SubIntervals = intervals:split(I, ToAdd),
      non_uniform_key_list_(SubIntervals, ToAdd, Fun, Acc, AccType).
  
  -spec non_uniform_key_list_
          (SubIs::[intervals:continuous_interval()], ToAdd::non_neg_integer(),
           Fun::random_bias:distribution_fun(), Acc::[result_k()],
           OutputType::list_key) -> [result_k()];
          (SubIs::[intervals:continuous_interval()], ToAdd::non_neg_integer(),
           Fun::random_bias:distribution_fun(), Acc::[result_kv()],
           OutputType::list_key_val) -> [result_kv()].
  non_uniform_key_list_([], _ToAdd, _Fun, Acc, _AccType) ->
      Acc;
  non_uniform_key_list_([SubI | R], ToAdd, Fun, Acc, AccType) ->
      ?ASSERT(not intervals:is_empty(SubI)),
      {Status, V} = Fun(),
      Add = erlang:trunc(V * ToAdd),
      NAcc = if Add >= 1 -> uniform_key_list([{SubI, Add}], Acc, AccType);
                true     -> Acc
             end,
      case Status of
          ok   -> non_uniform_key_list_(R, ToAdd, Fun, Acc, AccType);
          last -> NAcc
      end.
  
  