function cube_surface_distance_histogram ( n )

%*****************************************************************************80
%
%% cube_surface_distance_histogram histograms cube surface distance statistics.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 January 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of samples to use.
%
  p1 = cube_surface_sample ( n );
  p2 = cube_surface_sample ( n );
  t = vecnorm ( ( p1 - p2 )' );

  bins = 40;
  histogram ( t, bins, 'Binlimits', [0.0,sqrt(3.0)], 'Normalization', 'pdf' );
  grid ( 'on' );
  xlabel ( '<-- Distance -->' );
  ylabel ( '<-- Frequency -->' );
  title ( 'Distance between random points on unit cube surface' );

  return
end
