Sorting a mere 13 items of 1-byte each would require 6.2 GB of storage.
https://en.wikipedia.org/wiki/Permutation#Algorithms_to_gene...
.. and there
"Generation in lexicographic order"
This algorithm only requires you to hold the last permutation in memory to obtain a new (distinct) one.