anchor.diff:  % to DNS modules, and later they evaluate choose_nodes_for_dns/1 function on this
   % record. The record structure shall not be visible outside this module.
   -record(dns_lb_advice, {
  -    % How many requests have been processed using this advice.
  -    request_count = 0,
  -    % List of 3-element tuples {Node, Frequency, RequestCount}.
  -    % Node is a IP address.
  +    % List of 2-element tuples {Node, Frequency}.
  +    % Node is an IP address.
       % Frequency (relative to other nodes) is how often
       %   should given node appear at the top of DNS response.
  -    % RequestCount is how many times DID given node appear at the top of DNS
  -    %   response during using this advice.
  -    nodes_and_frequency = [] :: [{Node :: term(), Frequency :: float(), RequestCount :: integer()}],
  +    nodes_and_frequency = [] :: [{Node :: term(), Frequency :: float()}],
       % List of nodes to choose from. It introduces redundancy to above,
       % but consider that it will be used multiple times and each of these
       % times it would have to be calculated.
  
positive.code: %% @private
  %% @doc
  %% Helper function that returns the index of node which should be chosen based on
  %% current request counts.
  %% @end
  %%--------------------------------------------------------------------
  -spec choose_index(NodesAndFrequencies, RequestCount :: integer()) -> integer() when
      NodesAndFrequencies :: [{Node :: term(), Frequency :: float(), RequestCount :: integer()}].
  choose_index(NodesAndFrequencies, RequestCount) ->
      {_, Index, _} = lists:foldl(
          fun({_, Frequency, CurrReqCount}, {AccIndex, AccChoice, AccValue}) ->
              Value = Frequency * RequestCount - CurrReqCount,
              {NewChoice, NewValue} = case Value > AccValue of
                                          false -> {AccChoice, AccValue};
                                          true -> {AccIndex, Value}
                                      end,
              {AccIndex + 1, NewChoice, NewValue}
          end, {1, 0, -9999999}, NodesAndFrequencies),
      Index.
  
  %%--------------------------------------------------------------------
  %% @private
  
negative.code:         false ->
              node();
          true ->
              Index = choose_index(NodesAndFreq),
              {Node, _} = lists:nth(Index, NodesAndFreq),
              Node
      end.
  
  
  