aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/gnunet_container_lib.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index 204d3d6ab..bec040596 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -829,6 +829,21 @@ GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap,
829 829
830 830
831/** 831/**
832 * Return a *uniform* random element from the heap. Choose a random
833 * number between 0 and heap size and then walk directly to it.
834 * This cost can be between 0 and n, amortized cost of logN.
835 *
836 * @param heap heap to choose random element from
837 * @param max how many nodes from the heap to choose from
838 *
839 * @return data stored at the chosen random node,
840 * NULL if the heap is empty.
841 *
842 */
843void *
844GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap, uint32_t max);
845
846/**
832 * Perform a random walk of the tree. The walk is biased 847 * Perform a random walk of the tree. The walk is biased
833 * towards elements closer to the root of the tree (since 848 * towards elements closer to the root of the tree (since
834 * each walk starts at the root and ends at a random leaf). 849 * each walk starts at the root and ends at a random leaf).