RandomSample

RandomSample[{e1,e2,},n]
gives a pseudorandom sample of n of the .

RandomSample[{w1,w2,}{e1,e2,},n]
gives a pseudorandom sample of n of the chosen using weights .

RandomSample[{e1,e2,}]
gives a pseudorandom permutation of the .

DetailsDetails

  • RandomSample[{e1,e2,},n] never samples any of the more than once.
  • RandomSample[{e1,e2,},n] samples each of the with equal probability.
  • RandomSample gives a different sequence of pseudorandom choices whenever you run the Wolfram Language. You can start with a particular seed using SeedRandom.
  • A Method option to SeedRandom can be given to specify the pseudorandom generator used.
Introduced in 2007
(6.0)