function r8_chi_sample_test ( )

%*****************************************************************************80
%
%% r8_chi_sample_test() tests r8_chi_sample().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    25 July 2013
%
%  Author:
%
%    John Burkardt
%
  initialize ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8_CHI_SAMPLE_TEST\n' );
  fprintf ( 1, '  R8_CHI_SAMPLE ( DF ) samples the Chi distribution with\n' );
  fprintf ( 1, '  DF degrees of freedom.\n' );
%
%  Set the current generator index to #2.
%
  g = 2;
  cgn_set ( g );
  fprintf ( 1, '\n' );
  fprintf ( 1,  '  Current generator index = %d\n', g );
%
%  Repeatedly call R8_CHI_SAMPLE ( DF ).
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '   I       DF       R8_CHI_SAMPLE ( DF )\n' );
  fprintf ( 1, '\n' );

  for i = 1 : 10
    df = 5.0 * r8_uniform_01_sample ( ) + 1.0;
    u = r8_chi_sample ( df );
    fprintf ( 1, '  %2d  %14g  %14g\n', i, df, u );
  end

  return
end
