function [ tsp_distance, tsp_trip ] = tsp_random ( distance, trip_num )

%*****************************************************************************80
%
%% TSP_RANDOM approximately solves the Traveling Salesman Problem.
%
%  Input, DISTANCE(N,N), the distance matrix.
%
%  Input, TRIP_NUM, the number of random trips to try.
%
%  Output, TSP_DISTANCE, the minimum distance encountered.
%
%  Output, TSP_TRIP(N), the sequence of cities on the round trip.
%
  [ n, ~ ] = size ( distance );

  for i = 1 : trip_num

    this_trip = randperm ( n );

    this_distance = trip_distance ( distance, this_trip );

    if ( i == 1 || this_distance < tsp_distance )
      tsp_distance = this_distance;
      tsp_trip = this_trip;
    end

  end

  return
end
