Shuffle

Revision as of 19:57, 1 August 2007 by Max (talk | contribs) (Ready for UG)


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


You are not allowed to post comments.