function [ value, seed ] = r8_ren ( seed )

%*****************************************************************************80
%
%% R8_REN is a simple random number generator.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    15 May 2016
%
%  Author:
%
%    Matlab version by John Burkardt.
%
%  Reference:
%
%    Malcolm Pike, David Hill,
%    Algorithm 266:
%    Pseudo-Random Numbers,
%    Communications of the ACM,
%    Volume 8, Number 10, October 1965, page 605.
%
%  Parameters:
%
%    Output, real VALUE, the random value.
%
%    Input/output, integer SEED, a seed for the random number generator.
%
  i4_huge = 2147483647;
  seed = mod ( seed, floor ( i4_huge / 125 ) );
  seed = seed * 125;
  seed = seed - ( floor ( seed / 2796203 ) ) * 2796203;
  value = seed / 2796203.0;

  return
end
