Difference between revisions of "Shuffle"
(Ready for UG) |
|||
Line 1: | Line 1: | ||
[[Category:Distribution Functions]] | [[Category:Distribution Functions]] | ||
− | [[Category:Doc Status | + | [[Category:Doc Status M]] <!-- For Lumina use, do not change --> |
− | = Function Shuffle = | + | = Function Shuffle(a [, i]) = |
− | Shuffle returns a random permutation of the values in an array | + | Shuffle returns a random reordering (permutation) of the values in an array over index i. If you omit i [optional since build 4.0.0.48], it shuffles over Run. You may find this useful if you want to make a random sample from a probability distribution independent. |
== Declaration == | == Declaration == | ||
− | Shuffle( | + | Shuffle(a: Array[i]; i: IndexType = Run) |
− | If | + | If a contains dimensions other than i, it independently shuffles each slice over those other dimensions. |
− | If you want to shuffle an array | + | If you want to shuffle the slices an array over index I, but leaving the values within each slice unshuffled, you can do this: |
− | + | A[@I = Shuffle(@I,I)] | |
− | To make all slices of an uncertain result independent, use Shuffle(A), or equivalently, Shuffle(A,Run). | + | To make all slices of an uncertain result independent, use Shuffle(A), or equivalently, Shuffle(A,Run). |
− |
Revision as of 19:57, 1 August 2007
Function Shuffle(a [, i])
Shuffle returns a random reordering (permutation) of the values in an array over index i. If you omit i [optional since build 4.0.0.48], it shuffles over Run. You may find this useful if you want to make a random sample from a probability distribution independent.
Declaration
Shuffle(a: Array[i]; i: IndexType = Run)
If a contains dimensions other than i, it independently shuffles each slice over those other dimensions.
If you want to shuffle the slices an array over index I, but leaving the values within each slice unshuffled, you can do this:
A[@I = Shuffle(@I,I)]
To make all slices of an uncertain result independent, use Shuffle(A), or equivalently, Shuffle(A,Run).
Comments
Enable comment auto-refresher