diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-10-20 07:23:56 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-10-20 07:23:56 +0000 |
commit | 4b552398216ae6fd2587cce5d4ab5b2fed141f4e (patch) | |
tree | 634c83030c5d7271fd32194a2ae62b306f8e30d7 /src/util/container_multihashmap.c | |
parent | 2c784744bc7a15956c7ee766b5914559279ee83f (diff) | |
download | gnunet-4b552398216ae6fd2587cce5d4ab5b2fed141f4e.tar.gz gnunet-4b552398216ae6fd2587cce5d4ab5b2fed141f4e.zip |
remove get_random from API
Diffstat (limited to 'src/util/container_multihashmap.c')
-rw-r--r-- | src/util/container_multihashmap.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c index ac1905201..38cd65753 100644 --- a/src/util/container_multihashmap.c +++ b/src/util/container_multihashmap.c | |||
@@ -451,34 +451,4 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct | |||
451 | } | 451 | } |
452 | 452 | ||
453 | 453 | ||
454 | /** | ||
455 | * Returns the stored value of a random non-null entry in the hash | ||
456 | * table. Returns only the first value, does not go inside bucket | ||
457 | * linked list (yet). Runs with a worst case time of N, so it's not | ||
458 | * efficient in any way shape or form!!!!. | ||
459 | * | ||
460 | * @param map the map | ||
461 | * @return value associated with a random key | ||
462 | */ | ||
463 | void * | ||
464 | GNUNET_CONTAINER_multihashmap_get_random (const struct | ||
465 | GNUNET_CONTAINER_MultiHashMap *map) | ||
466 | { | ||
467 | unsigned int rand; | ||
468 | struct MapEntry *e; | ||
469 | |||
470 | if (map->size == 0) | ||
471 | return NULL; | ||
472 | while (1) | ||
473 | { | ||
474 | rand = | ||
475 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | ||
476 | map->map_length); | ||
477 | if (NULL != (e = map->map[rand])) | ||
478 | return e->value; | ||
479 | } | ||
480 | return e->value; | ||
481 | } | ||
482 | |||
483 | |||
484 | /* end of container_multihashmap.c */ | 454 | /* end of container_multihashmap.c */ |