Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Random Number Generation >

RandomChoice

RandomChoice[{e1, e2, ...}]
gives a pseudorandom choice of one of the ei.
RandomChoice[list, n]
gives a list of n pseudorandom choices.
RandomChoice[list, {n1, n2, ...}]
gives an n1n2... array of pseudorandom choices.
RandomChoice[{w1, w2, ...}->{e1, e2, ...}]
gives a pseudorandom choice weighted by the wi.
RandomChoice[wlist->elist, n]
gives a list of n weighted choices.
RandomChoice[wlist->elist, {n1, n2, ...}]
gives an n_1⨯n_2⨯… array of weighted choices.
  • RandomChoice[{e1, e2, ...}] chooses with equal probability between all of the ei.
  • 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.
New in 6
© 2013 Wolfram Research, Inc. Japanese
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team