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

%*****************************************************************************80
%
%% subset_distance_stats() estimates subset distance statistics.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 January 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, the size of the master set.
%
%    integer N, the number of sample points to use.
%
%  Output:
%
%    real MU, VAR, the estimated mean and variance of the
%    distance between two random subsets of an M set.
%
  t = zeros ( n, 1 );

  for i = 1 : n
    s1 = subset_sample ( m );
    s2 = subset_sample ( m );
    t(i) = subset_distance_hamming ( s1, s2 );
  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
 
