Difference between revisions of "RandomElement Command"
From GeoGebra Manual
Line 3: | Line 3: | ||
;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[{3, 2, -4, 7}]</nowiki></code> yields one of ''{-4, 2, 3, 7}''.</div>}} | ||
==CAS Syntax== | ==CAS Syntax== | ||
;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[{3, 2, -4, 7}]</nowiki></code> yields one of ''{-4, 2, 3, 7}''.</div>}} | ||
+ | {{note| 1=<div>See also [[Element Command]].</div>}} |
Revision as of 09:53, 24 August 2011
- 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}.
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[{3, 2, -4, 7}]
yields one of {-4, 2, 3, 7}.
Note:
See also Element Command.