gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r10578 - gnunet/src/include


From: gnunet
Subject: [GNUnet-SVN] r10578 - gnunet/src/include
Date: Fri, 12 Mar 2010 18:32:10 +0100

Author: nevans
Date: 2010-03-12 18:32:10 +0100 (Fri, 12 Mar 2010)
New Revision: 10578

Modified:
   gnunet/src/include/gnunet_container_lib.h
Log:
adding random_heap function definition in case I add it another way

Modified: gnunet/src/include/gnunet_container_lib.h
===================================================================
--- gnunet/src/include/gnunet_container_lib.h   2010-03-12 17:30:49 UTC (rev 
10577)
+++ gnunet/src/include/gnunet_container_lib.h   2010-03-12 17:32:10 UTC (rev 
10578)
@@ -829,6 +829,21 @@
 
 
 /**
+ * Return a *uniform* random element from the heap.  Choose a random
+ * number between 0 and heap size and then walk directly to it.
+ * This cost can be between 0 and n, amortized cost of logN.
+ *
+ * @param heap heap to choose random element from
+ * @param max how many nodes from the heap to choose from
+ *
+ * @return data stored at the chosen random node,
+ *         NULL if the heap is empty.
+ *
+ */
+void *
+GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap, uint32_t 
max);
+
+/**
  * Perform a random walk of the tree.  The walk is biased
  * towards elements closer to the root of the tree (since
  * each walk starts at the root and ends at a random leaf).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]