Function PGAShufflePGAInteger

Function Documentation

void PGAShufflePGAInteger(PGAContext *ctx, PGAInteger *list, int n)

Shuffle a list of PGAInteger.

Description

We’re using Durstenfeld’s version of the Fisher-Yates shuffle.

Example

PGAContext *ctx;
PGAInteger list [ctx->ga.StringLen];
...
for (i=0; i<ctx->ga.StringLen; i++) {
    list [i] = i;
}
PGAShuffle (ctx, list, ctx->ga.StringLen);

Parameters:
  • ctx – Context pointer

  • list – array of PGAInteger elements to shuffle

  • n – number of elements in array

Returns:

Shuffled array