Difference between revisions of "RandomElement Command"
From GeoGebra Manual
m (added links to commands) |
m (spacing) |
||
Line 6: | Line 6: | ||
{{hint| 1= | {{hint| 1= | ||
In the [[File:Menu view cas.svg|link=|16px]] [[CAS View]] this command also works with symbolic input. | In the [[File:Menu view cas.svg|link=|16px]] [[CAS View]] this command also works with symbolic input. | ||
− | :{{example| 1=<div><code><nowiki>RandomElement[{a,b,c,d}]</nowiki></code> yields one of ''{a,b,c,d}''.</div>}} | + | :{{example| 1=<div><code><nowiki>RandomElement[{a,b,c,d}]</nowiki></code> yields one of ''{a, b, c, d}''.</div>}} |
}} | }} | ||
{{note| 1=<div>See also [[Element Command]], [[SetSeed Command]], [[RandomBetween Command]], [[RandomBinomial Command]], [[RandomNormal Command]], [[RandomPoisson Command]] and [[RandomUniform Command]].</div>}} | {{note| 1=<div>See also [[Element Command]], [[SetSeed Command]], [[RandomBetween Command]], [[RandomBinomial Command]], [[RandomNormal Command]], [[RandomPoisson Command]] and [[RandomUniform Command]].</div>}} |
Revision as of 09:22, 30 August 2015
- RandomElement[ <List> ]
- Returns randomly chosen element from the list (with uniform probability). All elements in the list must be of the same type.
- Example:
RandomElement[{3, 2, -4, 7}]
yields one of {-4, 2, 3, 7}.
Hint: In the CAS View this command also works with symbolic input.
- Example:
RandomElement[{a,b,c,d}]
yields one of {a, b, c, d}.