Difference between revisions of "Shuffle"

(Edited, ready for UG)
Line 1: Line 1:
 
[[Category:Distribution Functions]]
 
[[Category:Distribution Functions]]
[[Category:Doc Status M]] <!-- For Lumina use, do not change -->
+
[[Category:Doc Status U]] <!-- For Lumina use, do not change -->
 +
 +
[[What's new in Analytica 4.0?]] >
  
 
= Function Shuffle(a [, i]) =
 
= Function Shuffle(a [, i]) =
 
   
 
   
Shuffle returns a random reordering (permutation) of the values in an array over index i. If you omit i, it shuffles over Run. [i is optional and defaults to Run since build 4.0.0.48.] You may find this useful if you want to make a random sample from a probability distribution independent.   
+
Shuffle returns a random reordering (permutation) of the values in array a over index i. If you omit i, it shuffles over Run. [Since build 4.0.0.48.] You can use it generate an independent random sample from an existing probability distribution, a.   
  
 
== Declaration ==
 
== Declaration ==
Line 10: Line 12:
 
  Shuffle(a: Array[i]; i: IndexType = Run)
 
  Shuffle(a: Array[i]; i: IndexType = Run)
  
If a contains dimensions other than i, it independently shuffles each slice over those other dimensions.
+
If a contains dimensions other than i, it shuffles each slice independently over each other dimension.
  
If you want to shuffle the slices an array over index I, but leaving the values within each slice unshuffled, you can do this:
+
If you want to shuffle the slices an array over index i, but not shuffle the values within each slice, use this method:
  
 
  A[@I = Shuffle(@I,I)]
 
  A[@I = Shuffle(@I,I)]
  
To make all slices of an uncertain result independent, use Shuffle(A), or equivalently, Shuffle(A,Run).
+
This creates a shuffle of index I, and uses that to reshuffle the slices of A over I. It does not shuffle each slice of A over any indexes of A other than I.

Revision as of 19:29, 28 August 2007


What's new in Analytica 4.0? >

Function Shuffle(a [, i])

Shuffle returns a random reordering (permutation) of the values in array a over index i. If you omit i, it shuffles over Run. [Since build 4.0.0.48.] You can use it generate an independent random sample from an existing probability distribution, a.

Declaration

Shuffle(a: Array[i]; i: IndexType = Run)

If a contains dimensions other than i, it shuffles each slice independently over each other dimension.

If you want to shuffle the slices an array over index i, but not shuffle the values within each slice, use this method:

A[@I = Shuffle(@I,I)]

This creates a shuffle of index I, and uses that to reshuffle the slices of A over I. It does not shuffle each slice of A over any indexes of A other than I.

Comments


You are not allowed to post comments.