This module provides data structure subjected to random choice of elements in uniform probability.
Inserts all elements of given list into the tree of second parameter. The first components of the tuple denotes the relative weight(1 means the whole weight of the original tree).
Removes any number of elements which fails to passes the test function given as the first parameter. The returned value is wrapped in Maybe.
Removes any number of elements which is the same as the first parameter from the second parameter. The returned value is wrapped in Maybe.
Random generator that generates one of the elements conteined in Tree given as parameter.
The time complexity is O(log(N)) where N denotes the size of the tree.
Random generator that generates one of the elements conteined in Tree, paired with the rest part of the tree.
If the Tree has only one element, then Nothing is returned as the second component.
The time complexity is O(log(N)) where N denotes the size of the tree.
Random generator that replaces one weighted data from the tree and generates a pair consisting of the removed data and resultant tree.
Type that represents binary tree with weighted elements for random picking up.