Difference between revisions of "RandomElement Command"
From GeoGebra Manual
Noel Lambert (talk | contribs) |
m (changed CAS example) |
||
Line 8: | Line 8: | ||
;RandomElement[ <List> ] | ;RandomElement[ <List> ] | ||
:Returns randomly chosen element from the [[Lists|list]] (with uniform probability). All elements in the list must be of the same type. | :Returns randomly chosen element from the [[Lists|list]] (with uniform probability). All elements in the list must be of the same type. | ||
− | :{{example| 1=<div><code><nowiki>RandomElement[{ | + | :{{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]].</div>}} | {{note| 1=<div>See also [[Element Command]].</div>}} | ||
{{Note|1= See also [[SetSeed Command|SetSeed command]], [[RandomBetween Command|RandomBetween command]], [[RandomBinomial Command|RandomBinomial command]], [[RandomNormal Command|RandomNormal command]], [[RandomPoisson Command|RandomPoisson command]], [[RandomUniform Command|RandomUniform command]].}} | {{Note|1= See also [[SetSeed Command|SetSeed command]], [[RandomBetween Command|RandomBetween command]], [[RandomBinomial Command|RandomBinomial command]], [[RandomNormal Command|RandomNormal command]], [[RandomPoisson Command|RandomPoisson command]], [[RandomUniform Command|RandomUniform command]].}} |
Revision as of 13:03, 26 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}.
Note:
See also Element Command.
CAS Syntax
- 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[{a,b,c,d}]
yields one of {a,b,c,d}.
Note:
See also Element Command.