function p = permutation_random ( n )

%*****************************************************************************80
%
%% PERMUTATION_RANDOM...
%
  p = ( 1 : n );

  for i = 1 : n - 1

    k = i4_random ( i, n );

    p1 = p(i);
    p(i) = p(k);
    p(k) = p1;

  end

  return
end
function value = i4_random ( lo, hi )

%*****************************************************************************80
%
%% I4_RANDOM ...
%
  r = ( hi + 1 - lo ) * rand ( );
  value = lo + floor ( r );

  return
end
