function [ mu, var ] = sphere_positive_distance_stats ( n )

%*****************************************************************************80
%
%% sphere_positive_distance_stats() estimates unit positive sphere distance statistics.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 August 2023
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    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 on the unit positive sphere.
%
  t = zeros ( n, 1 );
  for i = 1 : n
    p = sphere_positive_sample ( );
    q = sphere_positive_sample ( );
    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
