Difference between revisions of "Shuffle"

(added category)
(Optional I)
Line 8: Line 8:
 
== Declaration ==
 
== Declaration ==
  
  Shuffle(A : Array[I] ; I : IndexType)
+
  Shuffle(A : Array[I] ; I : IndexType = Run)
  
 
If A contains dimensions other than I, each slice of those dimensions will be independently shuffled.
 
If A contains dimensions other than I, each slice of those dimensions will be independently shuffled.
Line 15: Line 15:
  
 
  Slice(A, I, Shuffle(@I,I))
 
  Slice(A, I, Shuffle(@I,I))
 +
 +
To make all slices of an uncertain result independent, use Shuffle(A), or equivalently, Shuffle(A,Run). 
 +
(note: I is optional as of build 4.0.0.48)

Revision as of 20:06, 11 June 2007


Function Shuffle

Shuffle returns a random permutation of the values in an array along a given index.

Declaration

Shuffle(A : Array[I] ; I : IndexType = Run)

If A contains dimensions other than I, each slice of those dimensions will be independently shuffled.

If you want to shuffle an array along I, but have the same shuffling apply to all slices along other dimensions, you can do this:

Slice(A, I, Shuffle(@I,I))

To make all slices of an uncertain result independent, use Shuffle(A), or equivalently, Shuffle(A,Run). (note: I is optional as of build 4.0.0.48)

Comments


You are not allowed to post comments.