Calico
shuffle.h File Reference

Shuffling algorithm. More...

Functions

static void cal_shuffle (void *array, size_t count, size_t size, void *buffer, size_t(*randfunc)(void *, size_t), void *randfunc_ctx)
 Shuffles elements in an array. More...
 

Detailed Description

Shuffling algorithm.

Function Documentation

static void cal_shuffle ( void *  array,
size_t  count,
size_t  size,
void *  buffer,
size_t(*)(void *, size_t)  randfunc,
void *  randfunc_ctx 
)
inlinestatic

Shuffles elements in an array.

Parameters
arrayA pointer to an array of elements.
countThe number of elements in array.
sizeThe size of each element in bytes.
bufferA pointer to a temporary writable buffer capable of holding at least size bytes. It must not alias array.
randfuncA function that generates a nonnegative random value less than or equal to its second argument.
randfunc_ctxAn arbitrary value passed as the first argument to random.