function seeds ( )

%*****************************************************************************80
%
%% SEEDS shows how MATLAB's random number generator RAND uses a seed value.
%
%  Discussion:
%
%    Passing an integer SEED to RNG() before calling RAND() will determine
%    the random number sequence that will be generated.  At any time, RNG()
%    can be called again.  If the same value of SEED is sent in, the old
%    random number sequence will start again.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    15 February 2013
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'SEEDS:\n' );
  fprintf ( 1, '  Show how MATLAB''s RAND() random number generator\n' );
  fprintf ( 1, '  can be controlled using the RNG(SEED=value) call.\n' );

%
%  Set the seed to 123456789 and compute 5 random values.
%
  seed = 123456789;
  rng ( seed );
  x = rand ( 5, 1 )
%
%  Set the seed to a different value and compute 5 more random values.
%
  seed = 987654321;
  rng ( seed );
  x = rand ( 5, 1 )
%
%  If we set the seed back to 123456789 and compute 5 random values,
%  we get the same result as the first time.
%
  seed = 123456789;
  rng ( seed );
  x = rand ( 5, 1 )

  return
end

