>  Docs Center  >  Libraries  >  Daithi  >  SHUFFLE

SHUFFLE

SHUFFLE

Name


    SHUFFLE

Purpose


    This function shuffles the values in an array.

Category


    Array, Optimal Detection Package v3.1.1

Calling Sequence


    Result = SHUFFLE( X )

Inputs


    X: An array of any type.

Keyword Parameters


    INDEX: Returns the index values of the shuffled array.
    REPLACE: If set, the function shuffles with replacement. The default is
        without replacement.
    SEED: A seed for the random number generator to use.

Outputs


    Result: Returns the shuffled version of array X.
    INDEX: See above.
    SEED: See above. Also returns a seed for the next implementation of the
        random number generator.

Procedure


    This function used the RANDOMU IDL function to produce an array of random
    index values.

Example


    Define a vector.
      x = [0,1,2,3,4]
    Shuffle the vector with replacement.
      result = shuffle( x, replace=1, seed=1 )
    This should give result = [2,0,3,2,4].

Modification History


    Written by: Daithi Stone (stoned@atm.ox.ac.uk), 2001-07-18.
    Modified: DAS, 2002-11-21 (added seed initialisation).
    Modified: DAS, 2003-02-17 (allowed input of very long vectors)
    Modified: DAS, 2005-01-03 (added SEED keyword)
    Modified: DAS, 2011-03-16 (corrected bug when long vectors are input;
        modified formating)
    Modified: DAS, 2011-11-06 (Inclusion in Optimal Detection Package
        category)



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us