tail = list = NULL;
}
- /** Doesn't work with zero value */
- _Val getRandomValue() {
- while (true) {
- unsigned int index = random() & capacitymask;
- struct Hashlistnode<_Key, _Val> *bin = &table[index];
- if (bin->key != NULL && bin->val != NULL) {
- return bin->val;
- }
- }
- }
-
void resetAndDeleteKeys() {
for (unsigned int i = 0; i < capacity; i++) {
struct Hashlistnode<_Key, _Val> *bin = &table[i];
unsigned int oldcapacity = capacity;
if ((newtable = (struct Hashlistnode<_Key, _Val> *)ourcalloc(newsize, sizeof(struct Hashlistnode<_Key, _Val>))) == NULL) {
- model_print("calloc error %s %d\n", __FILE__, __LINE__);
exit(EXIT_FAILURE);
}