C++ bindings for cgul_shuffle
More...
#include <cgul_shuffle_cxx.h>
|
static void | cgul_shuffle (void *v, size_t v_count, size_t element_size, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_pointers (void **v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_schar (signed char *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_uchar (unsigned char *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_short (short int *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_ushort (unsigned short int *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_int (int *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_uint (unsigned int *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_long (long int *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_ulong (unsigned long int *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_int8 (cgul_int8_t *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_uint8 (cgul_uint8_t *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_int16 (cgul_int16_t *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_uint16 (cgul_uint16_t *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_int32 (cgul_int32_t *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
static void | cgul_shuffle_uint32 (cgul_uint32_t *v, size_t v_count, next_in_range_t next_in_range, void *client_data) |
|
This class provides the C++ bindings for cgul_shuffle
. The main purpose of this class is to convert the C-style function calls and exception handling into C++-style function calls and exception handling.
§ next_in_range_t
This type definition defines the interface to a pseudo-random number generator (PRNG) which the shuffle functions use to generate pseudo-random numbers that are used to shuffle an array. The quality of the shuffle depends entirely upon the quality of the pseudo-random numbers returned.
Functions that implement this interface will be passed the same client data client_data
that is passed into the shuffle function. The return value should be a pseudo-random integer in the half-open interval [0, range_max)
. If an error occurs when this function is called, the client should propagate the error via cex
.
Note that this interface closely resembles the signature of the cgul_random_*__next_in_range()
functions. So closely in fact, that it is usually not necessary to write a special callback to implement this function. Instead, this interface can be satisfied by casting cgul_random_*__next_in_range()
to have next_in_range_t
function type and pass in your PRNG object as the client data.
§ cgul_shuffle()
static void cgul_shuffle_cxx::cgul_shuffle |
( |
void * |
v, |
|
|
size_t |
v_count, |
|
|
size_t |
element_size, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
arbitrary elements of size element_size
(in bytes). If v
holds integers or pointers, one of the other shuffle functions tailored to the specific type will perform better. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32 - 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | element_size | size of each element in v (in bytes) |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_pointers()
static void cgul_shuffle_cxx::cgul_shuffle_pointers |
( |
void ** |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
void*
elements. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_schar()
static void cgul_shuffle_cxx::cgul_shuffle_schar |
( |
signed char * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type signed char
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_uchar()
static void cgul_shuffle_cxx::cgul_shuffle_uchar |
( |
unsigned char * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type unsigned char
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_short()
static void cgul_shuffle_cxx::cgul_shuffle_short |
( |
short int * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type short
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_ushort()
static void cgul_shuffle_cxx::cgul_shuffle_ushort |
( |
unsigned short int * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type unsigned short
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_int()
static void cgul_shuffle_cxx::cgul_shuffle_int |
( |
int * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type int
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_uint()
static void cgul_shuffle_cxx::cgul_shuffle_uint |
( |
unsigned int * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type unsigned int
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_long()
static void cgul_shuffle_cxx::cgul_shuffle_long |
( |
long int * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type long
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_ulong()
static void cgul_shuffle_cxx::cgul_shuffle_ulong |
( |
unsigned long int * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type unsigned long
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_int8()
static void cgul_shuffle_cxx::cgul_shuffle_int8 |
( |
cgul_int8_t * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type cgul_int8_t
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_uint8()
static void cgul_shuffle_cxx::cgul_shuffle_uint8 |
( |
cgul_uint8_t * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type cgul_uint8_t
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_int16()
static void cgul_shuffle_cxx::cgul_shuffle_int16 |
( |
cgul_int16_t * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type cgul_int16_t
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_uint16()
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type cgul_uint16_t
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_int32()
static void cgul_shuffle_cxx::cgul_shuffle_int32 |
( |
cgul_int32_t * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type cgul_int32_t
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
§ cgul_shuffle_uint32()
static void cgul_shuffle_cxx::cgul_shuffle_uint32 |
( |
cgul_uint32_t * |
v, |
|
|
size_t |
v_count, |
|
|
next_in_range_t |
next_in_range, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestatic |
Perform an in-place Fisher-Yates shuffle on the array v
having v_count
elements of type cgul_uint32_t
. The quality of the shuffle depends entirely on the quality of the random numbers returned by the next_in_range
callback which is passed the client data client_data
unmodified. Because this function assumes a 32-bit PRNG, v_count
can indicate no more than (2^32
- 1) elements. If an error occurs, an exception is thrown.
- Parameters
-
[in] | v | array of elements to shuffle |
[in] | v_count | number of elements in v |
[in] | next_in_range | PRNG callback |
[in] | client_data | client data for the PRNG callback |
The documentation for this class was generated from the following file: