Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
xt_shuffle(3)		    Library Functions Manual		   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)

								   xt_shuffle(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=xt_shuffle&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help