Don't know if this fits your use-case, but the ptx(1) command
permutes it's inputs. ptx(1) builds a permuted index of a
file's contents, and is used to create the "permuted index"
index page in unix (paper) manuals.
Perhaps the permutations that ptx(1) builds will suffice for
your use-case
HTH
--
Lew Pitcher
"In Skills, We Trust"