Takes an object of form key : probability (which acts as the probability mass function for all the keys in the object) and picks exactly one element according the a roll mapped to the mass function. The introduction above has an example of this.

An important thing to note with this function is that the values of the object must sum to 1 for it to represent a proper mass function (and to guarantee a return value).

Cluster picks {1, 2, ..., max} elements uniformly from the array with probability p, or it picks none at all with probability 1-p.

This is essentially a uniform distribution within a uniform distribution. It's uniform in that we either pick or don't pick with probability p, and if we pick, then how many we pick is uniformly distributed in the defined range. This creates the clusters, rather than true randomness.