xt_shuffle(3)

LIBRARY
#include <xtend/stdlib.h>
-lxtend

SYNOPSIS
void    xt_shuffle(void *base, size_t nelem, size_t size)

ARGUMENTS
base    Base address of the array (address of the first element)
nelem   Number of elements in the array
size    Size of one element

DESCRIPTION
Shuffle an array of objects using the Fisher-Yates method, which ensures equal probability of all arrangements.

EXAMPLES
type_t  *list;
size_t  list_size = 100;
if ( (list = xt_malloc(list_size, sizeof(*list))) == NULL)
{
    fprintf(stderr, "xt_malloc() failed.n");
    exit(EX_UNAVAILABLE);
}
xt_shuffle(list, list_size, sizeof(*list));

SEE ALSO
qsort(3), heapsort(3), mergesort(3)