Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica Table Question

  1. Feb 17, 2009 #1
    Hi everyone,

    Does anybody know how to randomly shuffle the positions within a table about? For example a table T = {1,2,3,4,5,6...} gets randomly shuffled to be T' = {7,3,5,1,4...} [or whatever].

    I thought there might be some kind of intrinsic RandomShuffle kind of function but can't find one...

  2. jcsd
  3. Feb 17, 2009 #2
    Use the RandomPermutation[] function. It should do the trick. (need to load the DiscreteMath package to use it)
  4. Feb 17, 2009 #3
    Brilliant, thank-you!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook