function [ dmu, dvar ] = cube_surface_distance_stats ( n, d )

%*****************************************************************************80
%
%% hypercube_surface_distance_stats estimates hypercube surface distance statistics.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    17 January 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of sample points to use.
%
%    integer D, the spatial dimension.
%
%  Output:
%
%    real DMU, DVAR, the estimated mean and variance of the
%    distance between two random points on the surface of the unit hypercube.
%
  p1 = hypercube_surface_sample ( n, d );
  p2 = hypercube_surface_sample ( n, d );
  t = vecnorm ( ( p1 - p2 )' );

  dmu = mean ( t );
  dvar = var ( t );

  return
end
