anchor.diff:                                  "{int(), int()}");
               _ -> false
           end.
  +
  +
  +
  +%% @doc Generate a random key from the pdf as defined in (Nagao, Shudo, 2011)
  +% TODO unit test that the generator doesn't generate keys from outside ?MINUS_INFINITY
  +% to ?PLUS_INFINITY
  +%% TODO
  +%I floor the key for now; the key generator should return ints, but returns
  +%float. It is currently unclear if this is a bug in the original paper by Nagao and
  +%Shudo. Using erlang:trunc/1 should be enough for flooring, as X >= 0
  +% TODO using the remainder might destroy the CDF. why can X > 2^128?
  +-spec get_random_key_from_generator(SourceNodeId :: key(),
  +                                    PredId :: key(),
  +                                    SuccId :: key()
  +                                   ) -> key().
  +get_random_key_from_generator(SourceNodeId, PredId, SuccId) ->
  +    Rand = random:uniform(),
  +    X = SourceNodeId + get_range(SourceNodeId, SuccId) *
  +        math:pow(get_range(SourceNodeId, PredId) /
  +                    get_range(SourceNodeId, SuccId),
  +                    Rand
  +                ),
  +    erlang:trunc(X) rem 16#100000000000000000000000000000000
  +    .
   
   %% userdevguide-begin rt_frtchord:handle_custom_message
   %% @doc Handle custom messages. The following messages can occur:
  
positive.code:                 source -> set_source_node(entry_nodeid(NewNode), RT);
                  _else  -> RT
              end,
              %% XXX DELETE
              %% assert that the ids of the adjacent nodes are still in the new table
              %% So: check that no ID exists which is not contained in the RT
              Adjs = [tuple_to_list(adjacent_fingers(N)) || N <- [NewPred, NewNode,
                      NewSucc]],
              Ids = lists:flatten(Adjs),
              false = lists:any(fun (none) -> true; (_) -> false end, [gb_trees:lookup(N,
                          Nodes) || N <- Ids]),
              rt_set_nodes(NewRT, Nodes);
          _else -> RT
      end
  
negative.code: %% @end
  %% @version $Id$
  
  -module(rt_frtchord).
  -author('mamuelle@informatik.hu-berlin.de').
  -vsn('$Id$').
  