function value = r8vec_median ( n, a )

%*****************************************************************************80
%
%% r8vec_median() returns the median of an unsorted R8VEC.
%
%  Discussion:
%
%    Hoare's algorithm is used.  The values of the vector are
%    rearranged by this routine.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    24 April 2005
%
%  Input:
%
%    integer N, the number of elements of A.
%
%    real A(N), the array to search.
%
%  Output:
%
%    real VALUE, the value of the median of A.
%
  k = round ( ( n + 1 ) / 2 );

  value = r8vec_frac ( n, a, k );

  return
end
