function r8vec = r8vec_uniform_01_sorted1 ( n )

%*****************************************************************************80
%
%% r8vec_uniform_01_sorted1() returns a sorted real random vector in [0,1].
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 April 2021
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Jon Bentley, James Saxe,
%    Generating sorted lists of random numbers,
%    ACM Transactions on Mathematical Software,
%    Volume 6, Number 3, September 1980, pages 359-364.
%
%  Input:
%
%    integer N, the number of values to generate.
%
%  Output:
%
%    real R8VEC(N), a real vector of random values
%    in ascending order.
%
  r8vec = zeros ( n, 1 );

  s = 0.0;
  for i = 1 : n + 1
    r = rand ( 1, 1 );
    s = s - log ( r );
    if ( i == n + 1 )
      break;
    end
    r8vec(i) = s;
  end
  
  r8vec(1:n) = r8vec(1:n) / s;

  return
end

  
