can anyone help me to generate random permutation using the following algorithm in java programming language, and show the result with no duplicated element
set p to identical permutation(1 to n)
for i = n down to 2 do {
set j to be a random integer with 1<=j<=i
swap p[j] and p[i]
end for
Aucun commentaire:
Enregistrer un commentaire