On 22/10/2026 1:48 am, Nicolas George wrote:
By the way, it seems what you want is not just distinct elements but all the elements too: a permutation. For that, there is a much more efficient algorithm: swap the first element randomly with any of the elements, then the second with any of the elements except the first, etc.
shuf(1) or, as it is recommended there, (info "(coreutils) shuf invocation") Unless the real goal is to explore BASH arrays.

