|
TPCCLIB
|
Random shuffle and related functions. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <math.h>#include <time.h>#include <string.h>#include "tpcextensions.h"#include "tpcrand.h"Go to the source code of this file.
Functions | |
| void | randomShuffle (int *array, unsigned int n, MERTWI *mt) |
| Random shuffle. | |
| void | randomShuffleUnsigned (unsigned int *array, unsigned int n, MERTWI *mt) |
| Random shuffle. | |
| void | randomPermutation (int *array, unsigned int n, int a, MERTWI *mt) |
| Random permutation for an array of signed integers. | |
| void | randomPermutationUnsigned (unsigned int *array, unsigned int n, unsigned int a, MERTWI *mt) |
| Random permutation for an array of unsigned integers. | |
Random shuffle and related functions.
Definition in file shuffle.c.
| void randomPermutation | ( | int * | array, |
| unsigned int | n, | ||
| int | a, | ||
| MERTWI * | mt ) |
Random permutation for an array of signed integers.
Given (allocated) array of length n is filled with random permutation of numbers (signed integers) in the range [a:n+a-1]; that is, each number once in random order.
| array | Allocated array to be filled. |
| n | Length of array. |
| a | Smallest integer value. |
| mt | Pointer to data structure for Mersenne Twister MT19937 pseudo-random number generator. |
Definition at line 80 of file shuffle.c.
| void randomPermutationUnsigned | ( | unsigned int * | array, |
| unsigned int | n, | ||
| unsigned int | a, | ||
| MERTWI * | mt ) |
Random permutation for an array of unsigned integers.
Given (allocated) array of length n is filled with random permutation of numbers (unsigned integers) in the range [a:n+a-1]; that is, each number once in random order.
| array | Allocated array to be filled. |
| n | Length of array. |
| a | Smallest integer value. |
| mt | Pointer to data structure for Mersenne Twister MT19937 pseudo-random number generator. |
Definition at line 106 of file shuffle.c.
| void randomShuffle | ( | int * | array, |
| unsigned int | n, | ||
| MERTWI * | mt ) |
Random shuffle.
Arrange the n elements of integer array in random order. Only effective if N is much smaller than UINT64_MAX.
| array | Integer array to be shuffled. |
| n | Array length. |
| mt | Pointer to data structure for Mersenne Twister MT19937 pseudo-random number generator. |
Definition at line 27 of file shuffle.c.
Referenced by randomPermutation().
| void randomShuffleUnsigned | ( | unsigned int * | array, |
| unsigned int | n, | ||
| MERTWI * | mt ) |
Random shuffle.
Arrange the n elements of unsigned integer array in random order. Only effective if N is much smaller than UINT64_MAX.
| array | Integer array to be shuffled. |
| n | Array length. |
| mt | Pointer to data structure for Mersenne Twister MT19937 pseudo-random number generator. |
Definition at line 54 of file shuffle.c.
Referenced by randomPermutationUnsigned().