public MapNode selectDestination(){
  double random=rng.nextDouble();
  double acc=0;
  for (  Tuple<Double,Integer> t : poiProbs) {
    acc+=t.getKey();
    if (acc > random) {
      List<MapNode> pois=poiLists.get(t.getValue());
      return pois.get(rng.nextInt(pois.size()));
    }
  }
  List<MapNode> allNodes=map.getNodes();
  MapNode node;
  do {
    node=allNodes.get(rng.nextInt(allNodes.size()));
  }
 while (okMapNodeTypes != null && !node.isType(okMapNodeTypes));
  return node;
}

public MapNode selectDestination ( ) { double random = rng . nextDouble ( ) ; double acc = 0 ; for ( Tuple < Double , Integer > t : poiProbs ) { acc += t . getKey ( ) ; if ( acc > random ) { List < MapNode > pois = poiLists . get ( t . getValue ( ) ) ; return pois . get ( rng . nextInt ( pois . size ( ) ) ) ; } } List < MapNode > allNodes = map . getNodes ( ) ; MapNode node ; do { node = allNodes . get ( rng . nextInt ( allNodes . size ( ) ) ) ; } while ( okMapNodeTypes != null && ! node . isType ( okMapNodeTypes ) ) ; return node ; }
selects a random destination from pois or all mapnodes . selecting among poi groups is done by their probabilities . if sum of their probabilities is less than 1 . 0 and the drawn random probability is bigger than the sum , a random mapnode is selected from the simmap .
