anchor.diff:      Index = random:uniform(length(List)),
       lists:nth(Index, List).
   
  +%% @private
  +select_random_sublist(View, K) ->
  +    List = members(View),
  +    lists:sublist(shuffle(List), K).
  +
   %% @doc Add to the active view.
   add_to_active_view({Name, _, _}=Peer, #state{active=Active0}=State0) ->
       lager:info("Adding ~p to active view on ~p", [Peer, myself()]),
  
positive.code:             State0
      end,
      {reply, ok, State};
  
  handle_message({forward_join, Peer, TTL, Sender},
                 #state{active=Active0,
  
negative.code: %% @private
  neighbor_acceptable(Priority, #state{active=Active}) ->
      Priority =:= high orelse not is_full({active, Active}).
  
  %% @private
  k_active() ->
      3.
  
  %% @private
  k_passive() ->
      4.
  
  %% @private
  schedule_passive_view_maintenance() ->
      erlang:send_after(?PASSIVE_VIEW_MAINTENANCE_INTERVAL,
                        ?MODULE,
                        passive_view_maintenance).
  
  %% @reference http://stackoverflow.com/questions/8817171/shuffling-elements-in-a-list-randomly-re-arrange-list-elements/8820501#8820501
  shuffle(L) ->
      [X || {_, X} <- lists:sort([{random:uniform(), N} || N <- L])].
  
  %% @private
  merge_exchange(Exchange, #state{active=Active, passive=Passive0}=State) ->
      %% Remove ourself and active set members from the exchange.
      ToAdd = Exchange -- ([myself()] ++ members(Active)),
  
      %% Add to passive set.
      Passive = lists:foldl(fun(X, P) ->
          add_to_passive_view(X, P)
                  end, Passive0, ToAdd),
  
      %% Return new state.
      State#state{passive=Passive}.
  