g05nc performs a pseudorandom permutation of a vector of integers.
Syntax
C# |
---|
public static void g05nc( int[] indx, int n, G05..::..G05State g05state, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g05nc ( _ indx As Integer(), _ n As Integer, _ g05state As G05..::..G05State, _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g05nc( array<int>^ indx, int n, G05..::..G05State^ g05state, [OutAttribute] int% ifail ) |
F# |
---|
static member g05nc : indx : int[] * n : int * g05state : G05..::..G05State * ifail : int byref -> unit |
Parameters
- indx
- Type: array<System..::..Int32>[]()[][]An array of size [n]On entry: the integer values to be permuted.On exit: the permuted integer values.
- n
- Type: System..::..Int32On entry: the number of values to be permuted.Constraint: .
- g05state
- Type: NagLibrary..::..G05..::..G05StateAn Object of type G05.G05State.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
g05nc permutes the elements of an integer array without inspecting their values. Each of the possible permutations of the values may be regarded as being equally probable.
Even for modest values of it is theoretically impossible that all permutations may occur, as is likely to exceed the cycle length of any of the base generators. For practical purposes this is irrelevant, as the time necessary to generate all possible permutations is many millenia.
One of the initialization methods (G05KFF not in this release) (for a repeatable sequence if computed sequentially) or (G05KGF not in this release) (for a non-repeatable sequence) must be called prior to the first call to g05nc.
References
Kendall M G and Stuart A (1969) The Advanced Theory of Statistics (Volume 1) (3rd Edition) Griffin
Knuth D E (1981) The Art of Computer Programming (Volume 2) (2nd Edition) Addison–Wesley
Error Indicators and Warnings
Errors or warnings detected by the method:
- On entry, .
On entry, state vector was not initialized or has been corrupted.
Accuracy
Not applicable.
Parallelism and Performance
None.
Further Comments
None.