function triangle_distance_histogram ( v, n )

%*****************************************************************************80
%
%% triangle_distance_histogram() histograms distance statistics for a given triangle.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    17 April 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real V(3,2), the vertices of the triangle.
%
%    integer N, the number of samples to use.
%
  p = triangle_sample ( v, n );
  q = triangle_sample ( v, n );

  t = ( p - q ) .^ 2;
  t = sum ( t, 2 );
  t = sqrt ( t );
  t_max = max ( t );

  bins = 20;
  histogram ( t, bins, 'Binlimits', [0.0,t_max], 'Normalization', 'pdf' );
  grid on
  xlabel ( '<-- Distance -->' )
  ylabel ( '<-- Frequency -->' )
  title ( 'Distance between a pair of random points in a triangle' )
  pause ( 5 );

  return
end
