I am not sure whether the following pseudo-code can generate an uniformly random permutation:
uniformly random permutation
PERMUTATE(A): n = A.length for i = 1 to n
This solution is biased, you want the Fisher Yates algorithm [which is similar] for non biased permutation. [basically, you need to swap with random(i,n) instead of with random(1,n)]
random(i,n)
random(1,n)
This thread discusses how and why your solution is biased.