function [ mu, var ] = hyperball_positive_distance_stats ( m, n )

%*****************************************************************************80
%
%% hyperball_positive_distance_stats estimates unit positive hyperball distance statistics.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    20 August 2023
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, the spatial dimension.
%
%    integer N, the number of sample points to use.
%
%  Output:
%
%    real MU, VAR, the estimated mean and variance of the
%    distance between two random points in the unit positive hyperball.
%
  t = zeros ( n, 1 );
  for i = 1 : n
    p = hyperball_positive_sample ( m );
    q = hyperball_positive_sample ( m );
    t(i) = norm ( p - q );
  end

  mu = sum ( t(1:n) ) / n;
  if ( 1 < n )
    var = sum ( ( t(1:n) - mu ) .^ 2 ) / ( n - 1 );
  else
    var = 0.0;
  end

  return
end
