it, void *it_cls);
-/**
- * Returns the stored value of a random non-null entry in the hash
- * table. Returns only the first value, does not go inside bucket
- * linked list (yet). Runs with a worst case time of N, so it's not
- * efficient in any way shape or form!!!!.
- *
- * @param map the map
- * @return value associated with a random key
- */
-void *GNUNET_CONTAINER_multihashmap_get_random (const struct
- GNUNET_CONTAINER_MultiHashMap
- *map);
-
-
-
-
/* ******************** doubly-linked list *************** */
/**
}
-/**
- * Returns the stored value of a random non-null entry in the hash
- * table. Returns only the first value, does not go inside bucket
- * linked list (yet). Runs with a worst case time of N, so it's not
- * efficient in any way shape or form!!!!.
- *
- * @param map the map
- * @return value associated with a random key
- */
-void *
-GNUNET_CONTAINER_multihashmap_get_random (const struct
- GNUNET_CONTAINER_MultiHashMap *map)
-{
- unsigned int rand;
- struct MapEntry *e;
-
- if (map->size == 0)
- return NULL;
- while (1)
- {
- rand =
- GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- map->map_length);
- if (NULL != (e = map->map[rand]))
- return e->value;
- }
- return e->value;
-}
-
-
/* end of container_multihashmap.c */
CHECK (0 ==
GNUNET_CONTAINER_multihashmap_get_multiple (m, &k2, NULL, NULL));
CHECK (2 == GNUNET_CONTAINER_multihashmap_iterate (m, NULL, NULL));
- r = GNUNET_CONTAINER_multihashmap_get_random (m);
- CHECK (0 == strcmp (r, "v1") || 0 == strcmp (r, "v2"));
CHECK (2 == GNUNET_CONTAINER_multihashmap_remove_all (m, &k1));
for (j = 0; j < 1024; j++)
CHECK (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (m,