function hypersphere_distance_histogram ( m, n )

%*****************************************************************************80
%
%% HYPERSPHERE_DISTANCE_HISTOGRAM histograms hypersphere distance statistics.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    29 September 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, the spatial dimension.
%
%    Input, integer N, the number of samples to use.
%
  for i = 1 : n
    p = hypersphere_unit_sample ( m );
    q = hypersphere_unit_sample ( m );
    t(i) = norm ( p - q );
  end

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

  return
end
