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

# RandomChoice

 RandomChoicegives a pseudorandom choice of one of the . RandomChoicegives a list of n pseudorandom choices. RandomChoicegives an ××... array of pseudorandom choices. RandomChoicegives a pseudorandom choice weighted by the . RandomChoice gives a list of n weighted choices. RandomChoice gives an ××... array of weighted choices.
• RandomChoice 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.
Choose among , , and at random:
A list of 20 random choices:
A 4×3 array of random choices:
Choices weighted with probabilities:
Weights are automatically normalized:
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]=
 Scope   (1)
The choices can be any expressions:
 Applications   (9)
Generate a random string:
Generate a weighted random string:
Generate integers according to a distribution:
Random array of color choices:
A random walk with steps of unit length:
2D random walk:
Random walk on a hexagonal lattice:
Randomly generate disks or circles:
A random graph with 1% of possible edges filled in:
Use SeedRandom to get repeatable random values:
Use BlockRandom to block one use of RandomChoice from affecting others:
Pick 10 random words beginning with "a" from the dictionary:
Pick 10 random Mathematica functions:
Make a continuous string of characters:
Break the characters into "words":
2D random walk with eight directions:
3D lattice random walk:
New in 6