Admin Production ni-theme
Current Publication

IntRiffleArray

LabWindows/CVI

IntRiffleArray

Advanced Analysis Library Only

AnalysisLibErrType IntRiffleArray (int inputArray[], ssize_t numberOfElements, int seed, ssize_t index[]);

Purpose

Riffles the input array of integer elements by randomly selecting two elements in inputArray, swapping those elements, and then repeating this process numberOfElements times, where numberOfElements is the size of inputArray.

Example Code

/* The following code riffles the elements in input array x. */
int x[20];
int y[20];
int n = 20, i;
for (i = 0; i < 20; i++)

x[i] = i * 2;

IntRiffleArray(x, n, 3, y);

Parameters

Input
Name Type Description
inputArray int [] The input array to riffle. inputArray is overwritten by the riffled array on exit.
numberOfElements ssize_t Number of elements in inputArray.
seed int The seed value at which to riffle input array.
When seed ≥ 0, IntRiffleArray generates a new random sequence using the seed value you specify.
When seed < 0, IntRiffleArray generates the sequence as a continuation of the previously generated noise sequence.
Output
Name Type Description
index ssize_t [] The corresponding index in the input array for each element in the riffled array.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 2012 and later