function [ xlo, xhi ] = xrange ( xlo, xhi )

  if ( xhi < xlo )   % <- Make sure XLO <= XHI
    t = xlo;         % <- You swap two variable values by using a helper variable "t".
    xlo = xhi;
    xhi = t;
  end

  xlo = max ( xlo, 0.0 );  %  <- Make sure XLO and XHI are in [0,1].
  xlo = min ( xlo, 1.0 );
  xhi = max ( xhi, 0.0 );
  xhi = min ( xhi, 1.0 );

  return
end
