This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

# RandomSample

 RandomSample gives a pseudorandom sample of n of the . RandomSample gives a pseudorandom sample of n of the chosen using weights . RandomSample gives a pseudorandom permutation of the .
• 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.
Find a sample in which no elements ever occur more than once:
Generate a random permutation:
Find a sample in which no elements ever occur more than once:
 Out[1]=

Generate a random permutation:
 Out[1]=
 Scope   (2)
The elements can be any expressions:
With larger weights for later elements, later elements tend to be selected for the sample:
 Applications   (1)
Successively fill in black squares down the page:
Use SeedRandom to get repeatable random values:
Use BlockRandom to block one use of RandomSample from affecting others:
RandomSample of size 1 follows the same distribution as RandomChoice:
If the sample size is larger than the population size, an error message is returned:
New in 6