function xs = r8vec_scale_01 ( n, x )
%*****************************************************************************80
%
%% r8vec_scale_01() scales an R8VEC to [0,1].
%
% Licensing:
%
% This code is distributed under the GNU LGPL license.
%
% Modified:
%
% 06 October 2018
%
% Author:
%
% John Burkardt
%
% Input:
%
% integer N, the number of entries in the vector.
%
% real X(N), the vector to be scaled.
%
% Output:
%
% real XS(N), the scaled vector.
%
xs = x(:);
xmin = min ( xs );
xmax = max ( xs );
if ( 0.0 < xmax - xmin )
xs = ( xs - xmin ) / ( xmax - xmin );
else
xs = 0.5;
end
return
end