function hypercube_distance_histogram ( m, n )

%*****************************************************************************80
%
%% hypercube_distance_histogram histograms hypercube distance statistics.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 January 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, the spatial dimension.
%
%    integer N, the number of samples to use.
%
  t = sqrt ...
  ( sum ...
    ( ...
      ( rand ( m, n ) - rand ( m, n ) ).^2 ...
    ) ...
  );

  bins = 20;
  histogram ( t, bins, 'Binlimits', [0.0,sqrt(m)], 'Normalization', 'pdf' );
  grid ( 'on' );
  xlabel ( '<-- Distance -->' );
  ylabel ( '<-- Frequency -->' );
  title_string = sprintf ( ...
    'Distance between random points in a unit %d cube', m );
  title ( title_string );

  return
end
