function runs_sample_test ( )

%*****************************************************************************80
%
%% runs_sample_test() tests runs_sample().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 April 2016
%
%  Author:
%
%    John Burkardt
%
  nsample = 1000;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'runs_sample_test():\n' );
  fprintf ( 1, '  runs_mean() computes the Runs mean;\n' );
  fprintf ( 1, '  runs_sample() samples the Runs distribution.\n' );
  fprintf ( 1, '  runs_variance() computes the Runs variance\n' );

  m = 10;
  n = 5;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  PDF parameter M = %14g\n', m );
  fprintf ( 1, '  PDF parameter N = %14g\n', n );

  x_mean = runs_mean ( m, n );
  x_var = runs_variance ( m, n );

  fprintf ( 1, '  PDF mean =                    %14g\n', x_mean );
  fprintf ( 1, '  PDF variance =                %14g\n', x_var );

  x = zeros ( nsample, 1 );
  for i = 1 : nsample
    x(i) = runs_sample ( m, n );
  end

  x_mean = mean ( x );
  x_var = var ( x );
  x_max = max ( x );
  x_min = min ( x );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Sample size =     %6d\n', nsample );
  fprintf ( 1, '  Sample mean =     %14f\n', x_mean );
  fprintf ( 1, '  Sample variance = %14f\n', x_var );
  fprintf ( 1, '  Sample maximum =  %6d\n', x_max );
  fprintf ( 1, '  Sample minimum =  %6d\n', x_min );

  return
end
