004b72a86c7fad684be7821df3123c68c573c548 kent Mon Dec 23 15:50:56 2013 -0800 Adding slListRandomReduce and slListRandomSample for making samples of larger lists. diff --git src/inc/obscure.h src/inc/obscure.h index ddc569e..0142093 100644 --- src/inc/obscure.h +++ src/inc/obscure.h @@ -138,30 +138,36 @@ void shuffleArrayOfChars(char *array, int arraySize); /* Shuffle array of characters of given size given number of times. */ void shuffleArrayOfInts(int *array, int arraySize); /* Shuffle array of ints of given size given number of times. */ void shuffleArrayOfPointers(void *pointerArray, int arraySize); /* Shuffle array of pointers of given size given number of times. */ void shuffleList(void *pList); /* Randomize order of slList. Usage: * shuffleList(&list) * where list is a pointer to a structure that * begins with a next field. */ +void *slListRandomReduce(void *list, double reduceRatio); +/* Reduce list to approximately reduceRatio times original size. Destroys original list. */ + +void *slListRandomSample(void *list, int maxCount); +/* Return a sublist of list with at most maxCount. Destroy list in process */ + char *stripCommas(char *position); /* make a new string with commas stripped out */ void dotForUserInit(int dotMod); /* Set how often dotForUser() outputs a dot. */ void dotForUser(); /* Write out a dot every _dotForUserMod times this is called. */ void spaceToUnderbar(char *s); /* Convert white space to underbar. */ void rangeRoundUp(double start, double end, double *retStart, double *retEnd); /* Round start and end so that they cover a slightly bigger range, but with more round * numbers. For instance 0.23:9.89 becomes 0:10 */