function [ cg1, cg2 ] = get_state ( )

%*****************************************************************************80
%
%% get_state() returns the state of the current generator.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 March 2013
%
%  Author:
%
%    Original Pascal version by Pierre L'Ecuyer, Serge Cote.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Pierre LEcuyer, Serge Cote,
%    Implementing a Random Number Package with Splitting Facilities,
%    ACM Transactions on Mathematical Software,
%    Volume 17, Number 1, March 1991, pages 98-111.
%
%  Output:
%
%    integer CG1, CG2, the CG values for the current generator.
%

%
%  Check whether the package must be initialized.
%
  if ( ~ initialized_get ( ) )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'GET_STATE - Note:\n' );
    fprintf ( 1, '  Initializing RNGLIB package.\n' );
    initialize ( );
  end
%
%  Get the current generator index.
%
  g = cgn_get ( );
%
%  Retrieve the key values for this generator.
%
  [ cg1, cg2 ] = cg_get ( g );

  return
end
