function toms515_test05 ( )

%*****************************************************************************80
%
%% TOMS515_TEST05 tests COMB by generating 10 random 10-subsets of a 100 set.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    30 March 2016
%
%  Author:
%
%    John Burkardt
%
  n = 100;
  k = 10;
  lmax = binom ( n, k );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'TOMS515_TEST05\n' );
  fprintf ( 1, '  Generate 10 random K-subsets of an N set.\n' );
  fprintf ( 1, '  K = %d\n', k );
  fprintf ( 1, '  N = %d\n', n );
  fprintf ( 1, '  LMAX = %d\n', lmax );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Note that this function is already\n' );
  fprintf ( 1, '  failing because LMAX is negative.\n' );
  fprintf ( 1, '  The combinatorial coefficient C(100,10)\n' );
  fprintf ( 1, '  is too large to store in an integer.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Although the program continues to give\n' );
  fprintf ( 1, '  results, they cannot be relied on!\n' );

  if ( ~ i4_choose_check ( n, k ) )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'TOMS515_TEST05 - Warning!\n' );
    fprintf ( 1, '  The binomial coefficient cannot be\n' );
    fprintf ( 1, '  computed in integer arithmetic for\n' );
    fprintf ( 1, '  this choice of parameters.\n' );
    return
  end

  fprintf ( 1, '\n' );

  seed = 123456789;

  for i = 1 : 10
    [ l, seed ] = i4_uniform_ab ( 1, lmax, seed );
    c = comb ( n, k, l );
    fprintf ( 1, '  %6d:  ', l );
    for j = 1 : k
      fprintf ( 1, '  %6d', c(j) );
    end
    fprintf ( 1, '\n' );
  end

  return
end

