function toms515_test02 ( )

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

  fprintf ( 1, '\n;' );
  fprintf ( 1, 'TOMS515_TEST02\n' );
  fprintf ( 1, '  Generate all 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 );

  if ( ~ i4_choose_check ( n, k ) )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'TOMS515_TEST02 - 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

