Effective implementation of algorithms (Master Thesis)
Effective and error-free implementation of algorithms
balanced_structures::skiplist::node_utils Namespace Reference

Functions

template<typename T >
randomLevel (Rand *rand, int levelup_prob_percent, T max_level)

Function Documentation

template<typename T >
T balanced_structures::skiplist::node_utils::randomLevel ( Rand rand,
int  levelup_prob_percent,
max_level 
)

Generate level of node randomly with geometric distribution with probablity p percent. Note: The resulting distribution is geometric distribution with cutoff at max_level (higher levels are accumulated to this last)

0 < p < 100 .

Parameters:
randrandom number generator
levelup_prob_percentprobability of level+1 over level
max_levellevel cutoff
Returns:
integer, level of a node, 1 <= level <= max_level
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines