If I have a list, I know that I can use the RandomSample function to randomly shuffle the list.

However, if I have $n$ lists, each with the same number of elements, is there a way to randomly shuffle the first list and then make the shuffles of the remaining lists be the same rearrangement?


1 Answer 1


Assuming your lists (let's call them list1 and list2 each have 100 items, then:

order = RandomSample[Range[100]];


(see the documentation for Part)

  • 2
    $\begingroup$ Thank you. Very helpful. I do not think you need curly brackets around order though since it is list already. $\endgroup$
    – Gabi23
    Commented Oct 7, 2021 at 23:59
  • $\begingroup$ Good point @Gabi23—I just typed this blindly. Modified above. $\endgroup$ Commented Oct 8, 2021 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.