anchor.diff:  -export_type([distribution/0, db_type/0, db_parameter/0, db_status/0, failure_type/0]).
   -endif.
   
  --type distribution() :: random |
  -                        uniform |
  -                        {non_uniform, random_bias:distribution_fun()}.
  +-type distribution()    :: random |
  +                           uniform |
  +                           {non_uniform, random_bias:distribution_fun()}.
  +-type db_distribution() :: uniform |
  +                           {non_uniform, random_bias:distribution_fun()}.
   -type result() :: ?RT:key() | 
                     {?RT:key(), db_dht:value()}.
   -type option() :: {output, list_key_val | list_key}.
  
positive.code:     {_, LKey, RKey, _} = intervals:get_bounds(I),
      Add = erlang:round(V * ToAdd),
      NAcc = if Add >= 1 ->
                    StepSize = erlang:round((RKey - LKey) / ToAdd),
                    SubI = intervals:new('(',
                                         LKey + ((Step - 1) * StepSize),
                                         LKey + (Step * StepSize),
                                         ']'),
                    uniform_key_list([{SubI, Add}], Acc, AccType);
                true -> Acc
  
negative.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, []).
  
  -spec get_db(intervals:continuous_interval(), non_neg_integer(), db_distribution(), [option()]) -> [result()].
  get_db(Interval, ItemCount, Distribution, Options) ->
      ?ASSERT(intervals:is_continuous(Interval)),
      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, 1, ItemCount, Fun, [], OutputType)
      end.
  