function [ mu, var ] = circle_distance_stats ( n )

%*****************************************************************************80
%
%% CIRCLE_DISTANCE_STATS estimates circle distance statistics.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    27 September 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    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 circle.
%
  for i = 1 : n
    p = circle_unit_sample ( );
    q = circle_unit_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
