BUILT-IN MATHEMATICA SYMBOL

# RandomChoice

RandomChoice[{e1, e2, ...}]
gives a pseudorandom choice of one of the .

RandomChoice[list, n]
gives a list of n pseudorandom choices.

RandomChoice[list, {n1, n2, ...}]
gives an ××... array of pseudorandom choices.

RandomChoice[{w1, w2, ...}->{e1, e2, ...}]
gives a pseudorandom choice weighted by the .

RandomChoice[wlist->elist, n]
gives a list of n weighted choices.

RandomChoice[wlist->elist, {n1, n2, ...}]
gives an ××... array of weighted choices.

## DetailsDetails

• RandomChoice[{e1, e2, ...}] chooses with equal probability between all of the .
• RandomChoice 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.

## ExamplesExamplesopen allclose all

### Basic Examples (4)Basic Examples (4)

Choose among , , and at random:

 Out[1]=

A list of 20 random choices:

 Out[1]=

A 4×3 array of random choices:

 Out[1]=

Choices weighted with probabilities:

 Out[1]=

Weights are automatically normalized:

 Out[2]=