Difference between revisions of "Sample Command"
From GeoGebra Manual
m (Bot: Automated text replacement (-{{command +{{command|cas=true)) |
|||
Line 1: | Line 1: | ||
<noinclude>{{Manual Page|version=4.0}}</noinclude> | <noinclude>{{Manual Page|version=4.0}}</noinclude> | ||
− | {{command|statistics}} | + | {{command|cas=true|statistics}} |
;Sample[ <List L>, <Size n> ] | ;Sample[ <List L>, <Size n> ] | ||
:Returns list of ''n'' randomly chosen elements of ''L''; elements can be chosen several times. | :Returns list of ''n'' randomly chosen elements of ''L''; elements can be chosen several times. |
Revision as of 13:51, 10 September 2011
- Sample[ <List L>, <Size n> ]
- Returns list of n randomly chosen elements of L; elements can be chosen several times.
- Example:
Sample[{1, 2, 3, 4, 5}, 5]
yields for example {1, 2, 1, 5, 4}.
- Sample[ <List L>, <Size n>, <Boolean for replacement> ]
- Returns list of n randomly chosen elements of L. Elements can be chosen several times if and only if the last parameter is true.
- Example:
Sample[{1, 2, 3, 4, 5}, 5, true]
yields for example {2, 3, 3, 4, 5}.
CAS Syntax
- Sample[ <List L>, <Size n> ]
- Returns list of n randomly chosen elements of L; elements can be chosen several times.
- Example:
Sample[{-5, 2, a, 7, c}, 3]
yields for example {a, 7, -5}.
- Sample[ <List L>, <Size n>, <Boolean for replacement> ]
- Returns list of n randomly chosen elements of L. Elements can be chosen several times if and only if the last parameter is true.
- Example:The list can include lists as well: Let List1 be {1, 2, 3}.
Sample[{List1, 4, 5, 6, 7, 8}, 3, false]
yields for example {6, {1, 2, 3}, 4}.