This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

RandomSample

RandomSample[{e1, e2, ...}, n]
gives a pseudorandom sample of n of the e_i.
RandomSample[{w1, w2, ...}->{e1, e2, ...}, n]
gives a pseudorandom sample of n of the e_i chosen using weights w_i.
RandomSample[{e1, e2, ...}]
gives a pseudorandom permutation of the e_i.
  • RandomSample[{e1, e2, ...}, n] never samples any of the e_i more than once.
  • RandomSample[{e1, e2, ...}, n] samples each of the e_i with equal probability.
  • RandomSample gives a different sequence of pseudorandom choices whenever you run Mathematica. You can start with a particular seed using SeedRandom.
  • A Method option to SeedRandom can be given to specify the pseudorandom generator used.
New in 6