d90f7fb5e4c32a447387691539145045c609b5b9 kent Thu Apr 25 09:34:50 2013 -0700 Removing useless shuffleCount parameter from shuffleList, shuffleArrayOfChars and shuffleArrayOfPointers functions in response to code review feedback. diff --git src/lib/obscure.c src/lib/obscure.c index b1b60bc..6621c8e 100644 --- src/lib/obscure.c +++ src/lib/obscure.c @@ -575,83 +575,82 @@ char *greek[] = {"B", "KB", "MB", "GB", "TB", "PB"}; int i = 0; long long d = 1; while ((size/d) >= 1024) { ++i; d *= 1024; } double result = ((double)size)/d; if (result < 10) safef(s,slength,"%3.1f %s",((double)size)/d, greek[i]); else safef(s,slength,"%3.0f %s",((double)size)/d, greek[i]); } -void shuffleArrayOfChars(char *array, int arraySize, int shuffleCount) +void shuffleArrayOfChars(char *array, int arraySize) /* Shuffle array of characters of given size given number of times. */ { char c; int i, randIx; /* Randomly permute an array using the method from Cormen, et al */ for (i=0; i<arraySize; ++i) { randIx = i + (rand() % (arraySize - i)); c = array[i]; array[i] = array[randIx]; array[randIx] = c; } } - -void shuffleArrayOfPointers(void *pointerArray, int arraySize, int shuffleCount) +void shuffleArrayOfPointers(void *pointerArray, int arraySize) /* Shuffle array of pointers of given size given number of times. */ { void **array = pointerArray, *pt; int i, randIx; /* Randomly permute an array using the method from Cormen, et al */ for (i=0; i<arraySize; ++i) { randIx = i + (rand() % (arraySize - i)); pt = array[i]; array[i] = array[randIx]; array[randIx] = pt; } } -void shuffleList(void *pList, int shuffleCount) +void shuffleList(void *pList) /* Randomize order of slList. Usage: * randomizeList(&list) * where list is a pointer to a structure that * begins with a next field. */ { struct slList **pL = (struct slList **)pList; struct slList *list = *pL; int count; count = slCount(list); if (count > 1) { struct slList *el; struct slList **array; int i; array = needLargeMem(count * sizeof(*array)); for (el = list, i=0; el != NULL; el = el->next, i++) array[i] = el; for (i=0; i<4; ++i) - shuffleArrayOfPointers(array, count, shuffleCount); + shuffleArrayOfPointers(array, count); list = NULL; for (i=0; i<count; ++i) { array[i]->next = list; list = array[i]; } freeMem(array); slReverse(&list); *pL = list; } } char *stripCommas(char *position) /* make a new string with commas stripped out */ {