function r8vec = r8vec_normal_01_sorted ( n )

%*****************************************************************************80
%
%% r8vec_normal_01_sorted() returns a sorted normal 01 random vector.
%
%  Discussion:
%
%    The Normal 01 distribution has mean 0 and standard deviation 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 normal 01 random values
%    in ascending order.
%
  cdfvec = r8vec_uniform_01_sorted1 ( n );
  
  r8vec = zeros ( n, 1 );

  for i = 1 : n
    r8vec(i) = normal_01_cdf_inv ( cdfvec(i) );
  end

  return
end

